Skip to content

Updating PivotTableUI prop does not always force a re-render of child renderer #43

@drheinheim

Description

@drheinheim

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions