Skip to content

shallow equality check before Plotly.react #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2018

Conversation

nicolaskruchten
Copy link
Contributor

This change moves the revision check out of shouldComponentUpdate because it's not "just an optimization" and also does a partial shallow equality check on props to skip calling Plotly.react if nothing has changed to avoid infinite loops.

nextProps.config === this.props.config &&
nextProps.frames === this.props.frames)
) {
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the move from shouldComponentUpdate to componentWilUpdate?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clearly I didn't read you initial comment... disregard

Copy link
Member

@bpostlethwaite bpostlethwaite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would including the data, layout check in shouldComponentUpdate also work?

💃

@nicolaskruchten
Copy link
Contributor Author

Yes but then the component wouldn't rerender the div if e.g. the style prop changed.

@nicolaskruchten nicolaskruchten merged commit 2742d0b into master Mar 7, 2018
@nicolaskruchten nicolaskruchten deleted the rerender_guard branch March 7, 2018 14:58
@nicolaskruchten nicolaskruchten restored the rerender_guard branch May 2, 2018 17:03
@nicolaskruchten nicolaskruchten deleted the rerender_guard branch May 2, 2018 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants