-
Notifications
You must be signed in to change notification settings - Fork 47.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
Regression test: Missing unmount after re-order #20285
Conversation
Adds a regression test for a bug I found in the effects refactor. The bug was that reordering a child that contains passive effects would cause the child to "forget" that it contains passive effects. This is because when a Placement effect is scheduled by the reconciler, it would override all of the fiber's flags, including its "static" ones: ``` child.flags = Placement; ``` The problem is that we use a static flag to use a "static" flag to track that a fiber contains passive effects. So what happens is that when the tree is deleted, the unmount effect is never fired. In the new implementation, the fix is to add the Placement flag without overriding the rest of the bitmask: ``` child.flags |= Placement; ``` (The old implementation doesn't need to be changed because it does not use static flags for this purpose.)
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 7426d00:
|
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 test!
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 test!
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 test!
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 test!
Nice test! |
That was a GitHub bug 😅 I was only excited enough about the test to comment twice. |
Nice test! |
Adds a regression test for a bug I found in the effects refactor.
The bug was that reordering a child that contains passive effects would cause the child to "forget" that it contains passive effects. This is because when a Placement effect is scheduled by the reconciler, it would override all of the fiber's flags, including its "static" ones:
The problem is that we use a static flag to use a "static" flag to track that a fiber contains passive effects.
So what happens is that when the tree is deleted, the unmount effect is never fired.
In the new implementation, the fix is to add the Placement flag without overriding the rest of the bitmask:
(The old implementation doesn't need to be changed because it does not use static flags for this purpose.)