Skip to content

Commit

Permalink
Merge pull request #1976 from weaveworks/1974-debounce-terminal-resizing
Browse files Browse the repository at this point in the history
Fixes the terminal spamming POST requests on resize
  • Loading branch information
davkal authored Nov 4, 2016
2 parents 722d5cd + 6c31f2a commit 5cb3a00
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/app/scripts/components/terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React from 'react';
import ReactDOM from 'react-dom';
import { connect } from 'react-redux';
import classNames from 'classnames';
import _ from 'lodash';

import { clickCloseTerminal } from '../actions/app-actions';
import { getNeutralColor } from '../utils/color-utils';
Expand Down Expand Up @@ -203,7 +204,7 @@ class Terminal extends React.Component {

const {characterWidth, characterHeight} = terminalCellSize(this.term.element);

window.addEventListener('resize', this.handleResize);
window.addEventListener('resize', _.debounce(this.handleResize, 500));

this.resizeTimeout = setTimeout(() => {
this.setState({
Expand Down

0 comments on commit 5cb3a00

Please sign in to comment.