Skip to content
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

Fix shallow renderer set instance state after gDSFP before calling sCU #14613

Merged

Conversation

@chenesan
Copy link
Contributor

@chenesan chenesan commented Jan 17, 2019

This PR fixes #14607 which is related to enzymejs/enzyme#1970 . Before this the shallow renderer will update instance state before shouldComponentUpdate if getDeriveStateFromProps return new partial state, make the passed nextState and old this.state the same in shouldComponentUpdate, which is different behavior with real rendering with ReactDOM.render (see the tests).

@gaearon
Copy link
Member

@gaearon gaearon commented Jan 18, 2019

I think _updateStateFromStaticLifecycle might have been creating more confusion than what it's worth due to timing issues of what writes when. So I unwound it. I think this makes sense.

Copy link
Member

@gaearon gaearon left a comment

I checked Enzyme tests and they pass. Seems good. Thanks.

@gaearon gaearon merged commit 4f33288 into facebook:master Jan 18, 2019
1 check passed
1 check passed
ci/circleci Your tests passed on CircleCI!
Details
jetoneza added a commit to jetoneza/react that referenced this pull request Jan 23, 2019
facebook#14613)

* Fix shallow renderer set instance state after gDSFP before calling sCU

* Update ReactShallowRenderer.js

* Unwind abstraction

* Fewer names
n8schloss added a commit to n8schloss/react that referenced this pull request Jan 31, 2019
facebook#14613)

* Fix shallow renderer set instance state after gDSFP before calling sCU

* Update ReactShallowRenderer.js

* Unwind abstraction

* Fewer names
This was referenced Sep 20, 2019
NMinhNguyen referenced this pull request in enzymejs/react-shallow-renderer Jan 29, 2020
…U (#14613)

* Fix shallow renderer set instance state after gDSFP before calling sCU

* Update ReactShallowRenderer.js

* Unwind abstraction

* Fewer names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants