Skip to content
Snippets Groups Projects
Unverified Commit 329b540b authored by Mahatthana (Kelvin) Nomsawadi's avatar Mahatthana (Kelvin) Nomsawadi Committed by GitHub
Browse files

Fix regression from fixing #20954 (#21051)

* Fix a regression from fixing #20228

* Reorder code order to make it easier to reason about.
parent 37f3ab43
No related branches found
No related tags found
No related merge requests found
......@@ -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();
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment