-
-
Notifications
You must be signed in to change notification settings - Fork 283
Description
I'm trying to create what amounts to my own version of Plotly's react-chart-editor. In doing so, I'm passing a layout prop to my component, which I then include in my PlotlyRenderer.js for the final render. Pretty straightforward. However, updates to layout (changes in chart title, etc.) propagate only to the first PivotTableUI configuration. If I change the configuration (pivot the data), subsequent changes to layout do not propagate to the child plot renderer.
My solution to this is to add a key to the main PivotTableUI component, consisting of the stringified version of the layout object. I.e., <PivotTableUI key={JSON.stringify(layout)} ...otherProps />. This works, but I'm not sure if it's correct. If it is correct, perhaps this should be done within the PivotTableUI component itself? An alternative might be to use componentWillReceiveProps and shouldComponentUpdate?