-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Even when setState returns null, it calls cDU lifecycle. #1783
Comments
I had no idea the return value of setState mattered at all. cc @koba04 Thanks, I’ll get a fix for this in soon. |
@Ailrun in that code sandbox, when i type a single letter, i get a single console log - but i get the same even if i comment out the Thanks for the report. |
@ljharb yes, it also ignores |
Thanks to open the issue! I’ll working on this. |
@koba04 i'm about to restructure all the lifecycle method tests, so you may want to hold off for an hour or so :-) |
@ljharb That sounds great! I cannot wait to use fixed lifecycles 😃 |
@koba04 k, go for it :-D |
I've created a PR to fix this. #1785 |
@ljharb Can I know when will this be released? |
I'll probably release a v3.5.0 later this week. |
@ljharb Really thank you for this fast response! |
Describe the bug
In React, if
setState
returnsnull
, cDU is not called and so following does not make infinite loop even after cDU is called. (You can check it on this codesandbox by typing text on the input. It prints only one console log at a time.)However, in
enzyme
, when I update component, i.e., invoking cDU with above component, will gives me infinite loop likeTo Reproduce
git clone https://github.com/Ailrun/enzyme-issue1783
npm i
npm test
Expected behavior
Does not give infinite loop.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: