mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-05 11:11:13 +00:00
Merge pull request #1976 from weaveworks/1974-debounce-terminal-resizing
Fixes the terminal spamming POST requests on resize
This commit is contained in:
@@ -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';
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user