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

Commit 6d945c4

Browse files
committed
Don't attempt to resize unmounted graphs
Fixes #534
1 parent e901607 commit 6d945c4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/Graph.react.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,10 @@ class PlotlyGraph extends Component {
196196
componentDidMount() {
197197
this.plot(this.props).then(() => {
198198
window.addEventListener('resize', () => {
199-
Plotly.Plots.resize(document.getElementById(this.props.id));
199+
const graphDiv = document.getElementById(this.props.id);
200+
if (graphDiv) {
201+
Plotly.Plots.resize(graphDiv);
202+
}
200203
});
201204
});
202205
}

0 commit comments

Comments
 (0)