diff --git a/frontend/src/metabase/components/DebouncedFrame.jsx b/frontend/src/metabase/components/DebouncedFrame.jsx index 85de80bcc1bb1a6d7753fcf36aef55afff0ac93b..c09710b67247ab27133eb02551f17f8f4d4401f8 100644 --- a/frontend/src/metabase/components/DebouncedFrame.jsx +++ b/frontend/src/metabase/components/DebouncedFrame.jsx @@ -32,12 +32,18 @@ export default class DebouncedFrame extends React.Component { }; } - setSize = (width, height) => { + updateSize = () => { this._transition = false; - this.setState({ width, height }, this._updateTransitionStyle); + + const { width, height } = this.props; + if (width !== this.state.width || height !== this.state.height) { + this.setState({ width, height }, this._updateTransitionStyle); + } else { + this._updateTransitionStyle(); + } }; - setSizeDebounced = _.debounce(this.setSize, DEBOUNCE_PERIOD); + updateSizeDebounced = _.debounce(this.updateSize, DEBOUNCE_PERIOD); UNSAFE_componentWillReceiveProps(nextProps) { if (!nextProps.enabled) { @@ -49,11 +55,11 @@ export default class DebouncedFrame extends React.Component { this.state.height !== nextProps.height ) { if (this.state.width == null || this.state.height == null) { - this.setSizeDebounced(nextProps.width, nextProps.height); + this.updateSizeDebounced(); } else { - this.setSizeDebounced(nextProps.width, nextProps.height); this._transition = true; this._updateTransitionStyle(); + this.updateSizeDebounced(); } } }