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:
vera-liu
2016-12-15 14:06:54 -08:00
committed by GitHub
parent e06a0cd89b
commit 7a5bb94754
3 changed files with 38 additions and 23 deletions

View File

@@ -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() {