mirror of
https://github.com/apache/superset.git
synced 2026-04-11 20:37:16 +00:00
Stop ChartContainer from rendering twice on chartStatus change (#1828)
* Stop ChartContainer from rendering twice on chartStatus change * Make spinner overlay and dim chart while laoding * Added timeout to make render more stable on resize * Put viz in state and call resize at browser size change * add render after height change since resize depends on render called on the same object * Change name of renderVis to renderVisOnChange * Only call resize at height change, persist viz in state * Call resize wihout render at window size change
This commit is contained in:
@@ -29,7 +29,6 @@ class ExploreViewContainer extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
window.addEventListener('resize', this.handleResize.bind(this));
|
||||
this.props.actions.updateChartStatus('success');
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@@ -64,7 +63,10 @@ class ExploreViewContainer extends React.Component {
|
||||
}
|
||||
|
||||
handleResize() {
|
||||
this.setState({ height: this.getHeight() });
|
||||
clearTimeout(this.resizeTimer);
|
||||
this.resizeTimer = setTimeout(() => {
|
||||
this.setState({ height: this.getHeight() });
|
||||
}, 250);
|
||||
}
|
||||
|
||||
toggleModal() {
|
||||
|
||||
Reference in New Issue
Block a user