From cb01371d38cd63bd43395b63498117e8e2d13dd3 Mon Sep 17 00:00:00 2001 From: wbrgss Date: Thu, 6 Jun 2019 22:25:30 -0400 Subject: [PATCH] Don't attempt to resize unmounted graphs Fixes #534 --- src/components/Graph.react.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/Graph.react.js b/src/components/Graph.react.js index f72c2e1d5..05aa21471 100644 --- a/src/components/Graph.react.js +++ b/src/components/Graph.react.js @@ -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); + } }); }); }