-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- only re-render component if props or requests shallowly changed - this.setAtomicState now creates new objects for all 4 keys - added tests for `pure: true` and `pure: false` - added `pure` option to api docs
- Loading branch information
Showing
3 changed files
with
497 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
7a88aea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nfcampos I just got bit by facebook/react#2517 after this commit. I don't think there's much we can do at this point (unless you know of something?), but just something to be aware of and apps will need to use
pure: false
to workaround it.7a88aea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ryanbrainard Yeah as you said there's not much we can do here. A couple more workarounds:
react-router
has implemented Make <Link> work with static containers (take two) remix-run/react-router#3430 for version 3.0 (not yet released) to work around this for theLink
component (basically it's something like the parent component that provides context provides a subscribe method so that child components that need the context subscribe to changes in the context and on receiving new context via this event subscription re-render). They have plans to pull this workaround into a separate library soon Extract ContextUtils into react-context-subscriber remix-run/react-router#3484 so if you control the components that use context you can use the same technique.shouldComponentUpdate
compare context as well. This would allow people that use context in the wrapped component to usepure: true
but doesn't solve anything if you use further down the tree