-
-
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
Fix double unmount #4105
Fix double unmount #4105
Conversation
This should fix #4104.
📊 Tachometer Benchmark ResultsSummaryA summary of the benchmark results will show here once they finish. ResultsThe full results of your benchmarks will show here once they finish. |
Size Change: +8 B (0%) Total Size: 57.3 kB
ℹ️ View Unchanged
|
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.
Added a test.
Something fun I noticed: You can't observe this bug using lifecycles cuz on the first unmount, we clear _component
which prevents re-entry into the part of unmount
that invokes componentWillUnmount
.
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.
Nice catch 👍
This should fix #4104.
I believe the issue is that
unmount()
is triggered for the VNode atoldChildren[i]
, but that VNode remains inoldChildren
. When we hit the end ofdiffChildren()
, a loop invokesunmount()
on every non-null vnode inoldChildren
, which still includes the eagerly-unmounted VNode.I didn't have a chance to add a test as I'm doing this from GH web, if someone gets around to it before me we can likely just use the example from #4104.