Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
Don't attempt to resize unmounted graphs
Browse files Browse the repository at this point in the history
Fixes #534
  • Loading branch information
wbrgss committed Jun 7, 2019
1 parent e901607 commit 6d945c4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/Graph.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@ class PlotlyGraph extends Component {
componentDidMount() {
this.plot(this.props).then(() => {
window.addEventListener('resize', () => {
Plotly.Plots.resize(document.getElementById(this.props.id));
const graphDiv = document.getElementById(this.props.id);
if (graphDiv) {
Plotly.Plots.resize(graphDiv);
}
});
});
}
Expand Down

0 comments on commit 6d945c4

Please sign in to comment.