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
Member

@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.
@codesandbox
Copy link

@codesandbox codesandbox 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 sizebot commented Apr 1, 2020

No significant bundle size changes to report.

Size changes (stable)

Generated by 🚫 dangerJS against da358fc

@sizebot
Copy link

@sizebot sizebot commented Apr 1, 2020

No significant bundle size changes to report.

Size changes (experimental)

Generated by 🚫 dangerJS against da358fc

@gaearon
Copy link
Member

@gaearon 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?

@gaearon
gaearon approved these changes Apr 1, 2020
Copy link
Member

@gaearon gaearon left a comment

makes sense

@acdlite
Copy link
Member Author

@acdlite 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
31 checks passed
31 checks passed
ci/circleci: NODE_ENV_production_yarn_test_www Your tests passed on CircleCI!
Details
ci/circleci: NODE_ENV_production_yarn_test_www_variant Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_NODE_ENV_production_yarn_test_www Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_NODE_ENV_production_yarn_test_www_variant Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_build Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_test Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_test_build Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_test_build_prod Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_test_dom_fixtures Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_test_persistent Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_test_prod Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_test_www Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_test_www_variant Your tests passed on CircleCI!
Details
ci/circleci: build_devtools_and_process_artifacts Your tests passed on CircleCI!
Details
ci/circleci: process_artifacts Your tests passed on CircleCI!
Details
ci/circleci: process_artifacts_experimental Your tests passed on CircleCI!
Details
ci/circleci: setup Your tests passed on CircleCI!
Details
ci/circleci: sizebot_experimental Your tests passed on CircleCI!
Details
ci/circleci: sizebot_stable Your tests passed on CircleCI!
Details
ci/circleci: yarn_build Your tests passed on CircleCI!
Details
ci/circleci: yarn_flow Your tests passed on CircleCI!
Details
ci/circleci: yarn_lint Your tests passed on CircleCI!
Details
ci/circleci: yarn_lint_build Your tests passed on CircleCI!
Details
ci/circleci: yarn_test Your tests passed on CircleCI!
Details
ci/circleci: yarn_test_build Your tests passed on CircleCI!
Details
ci/circleci: yarn_test_build_devtools Your tests passed on CircleCI!
Details
ci/circleci: yarn_test_build_prod Your tests passed on CircleCI!
Details
ci/circleci: yarn_test_prod Your tests passed on CircleCI!
Details
ci/circleci: yarn_test_www Your tests passed on CircleCI!
Details
ci/circleci: yarn_test_www_variant Your tests passed on CircleCI!
Details
ci/codesandbox Building packages succeeded.
Details
@gaearon gaearon deleted the acdlite:primary-child-fix branch Apr 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.