-
-
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
componentDidMount not called in a specific case #172
Comments
kruczy I have the similar issue before and |
Yes, |
Whoops, didn't see beta6 it calls both mount and unmount now but unmount gets called 3 times in a row, this is much better now as protecting against multiple calls to unmount is quite easy, though probably should be fixed |
Agreed. I'm thinking it might finally be time to store a "mounted" boolean, but I'd also just like to address why Preact is even trying to unmount them in the first place. I think it's the High Order Component recursion seeing a new "owner" component for the same element 3 times (because the nesting level is 3). Thanks so much for this repro! You guys have been awesome. |
@kruczy + @zhenkunou - Forgot to tag the commit with this issue, but I've published what I hope is a proper fix for this. It fixes the repro: http://jsfiddle.net/developit/48e5jdsk/7/ Closing as hopeful for now but let me know if you have other cases/repros that are still affected! |
The lifecycle hook
componentDidMount
does not get called for components that return false formshouldComponentUpdate
and are wrapped in a normal componentsee repro:
http://jsfiddle.net/2sh26um7/4/ (4.8.0)
http://jsfiddle.net/48e5jdsk/2/ (5.0.0-beta5)
the beta fixes the immediate issue from 4.8.0 but if you wrap the component twice the same problem happens
click the toggle button 4 times in console you will see mount unmount unmount
the expected log would be mount unmount mount unmount
if you remove the wrapper the log is correct
If there is anything I can help with please let me know
The text was updated successfully, but these errors were encountered: