Skip to content
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

Merged
merged 1 commit into from Apr 1, 2020

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Apr 1, 2020

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.

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.
@acdlite acdlite requested review from gaearon and jstejada April 1, 2020 20:34
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Apr 1, 2020
@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 1, 2020

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:

Sandbox Source
practical-joliot-192gt Configuration

@sizebot
Copy link

sizebot commented Apr 1, 2020

No significant bundle size changes to report.

Size changes (stable)

Generated by 🚫 dangerJS against da358fc

@sizebot
Copy link

sizebot commented Apr 1, 2020

No significant bundle size changes to report.

Size changes (experimental)

Generated by 🚫 dangerJS against da358fc

@gaearon
Copy link
Collaborator

gaearon commented Apr 1, 2020

We can't rely on the primary fiber's childExpirationTime field to be correct.

Is this the only place we rely on it?

Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense

@acdlite
Copy link
Collaborator Author

acdlite commented Apr 1, 2020

Is this the only place we rely on it?

I think so, yeah

@acdlite acdlite merged commit 58afba0 into facebook:master Apr 1, 2020
@gaearon gaearon deleted the primary-child-fix branch April 1, 2020 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants