-
Notifications
You must be signed in to change notification settings - Fork 47k
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: Don't read primaryChild.childExpirationTime #18457
Conversation
This is a variant of the fix in 5a0f1d. We can't rely on the primary fiber's `childExpirationTime` field to be correct. In this case, we can read from the Suspense boundary fiber instead. This will include updates that exist in the fallback fiber, but that's not a big deal; the important thing is that we don't drop updates.
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 da358fc:
|
Is this the only place we rely on it? |
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.
makes sense
I think so, yeah |
This is a variant of the fix in 5a0f1d5. We can't rely on the primary fiber's
childExpirationTime
field to be correct.In this case, we can read from the Suspense boundary fiber instead. This will include updates that exist in the fallback fiber, but that's not a big deal; the important thing is that we don't drop updates.
Longer term, we'll likely remove fragment reparenting from the Suspense implementation. It's only there to save on memory but because it's the only place we do reparenting, it's been hard to maintain.
If we ever do add reparenting, what this bug demonstrates is that the state tree and the UI tree are not the same thing. It just happens to be that in current React (no reparenting), the "state ancestors" of a node are always subset of its "UI ancestors", which is why we can get away with only having a single return path.