You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ljharb
changed the title
Shallow rendering: setState after setProps calls componenetWillReceiveProps
Shallow rendering: setState after setProps calls componentWillReceiveProps
Aug 11, 2018
Describe the bug
On a shallow wrapper, calling
setState
after callingsetProps
triggerscomponenetWillReceiveProps
which it should not.I believe this has something to do with https://github.com/airbnb/enzyme/blob/9b4d0276f57e54be06aca6c3636120b3c4053310/packages/enzyme/src/ShallowWrapper.js#L361 which clones the props causing
https://github.com/facebook/react/blob/be4533af7d29f020499d3c01931e55ef8666a419/packages/react-test-renderer/src/ReactShallowRenderer.js#L183
to be
true
on the subsequent setState callhttps://github.com/airbnb/enzyme/blob/9b4d0276f57e54be06aca6c3636120b3c4053310/packages/enzyme/src/ShallowWrapper.js#L441
To Reproduce
Expected behavior
componenetWillReceiveProps
should not be called after callingsetState
The text was updated successfully, but these errors were encountered: