From c30c3df9aae8d6bf89e3ee7b6ff3bc98dede6202 Mon Sep 17 00:00:00 2001 From: Scimonster Date: Thu, 10 Aug 2017 13:23:02 +0300 Subject: [PATCH] Plotly also mutates the data object, so apply cloneDeep here too --- src/PlotlyComponent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PlotlyComponent.js b/src/PlotlyComponent.js index d4ee681..840cbec 100644 --- a/src/PlotlyComponent.js +++ b/src/PlotlyComponent.js @@ -34,7 +34,7 @@ let createPlotlyComponent = (plotlyInstance) => React.createClass({ componentDidMount() { let {data, layout, config} = this.props; - plotlyInstance.newPlot(this.container, data, cloneDeep(layout), config); //We clone the layout as plotly mutates it. + plotlyInstance.newPlot(this.container, cloneDeep(data), cloneDeep(layout), config); //We clone the data and layout as plotly mutates them. this.attachListeners(); }, @@ -42,7 +42,7 @@ let createPlotlyComponent = (plotlyInstance) => React.createClass({ //TODO use minimal update for given changes if (prevProps.data !== this.props.data || prevProps.layout !== this.props.layout || prevProps.config !== this.props.config) { let {data, layout, config} = this.props; - plotlyInstance.newPlot(this.container, data, cloneDeep(layout), config); //We clone the layout as plotly mutates it. + plotlyInstance.newPlot(this.container, cloneDeep(data), cloneDeep(layout), config); //We clone the data and layout as plotly mutates them. this.attachListeners(); } },