Repository navigation
[Reconciler] Preserve the portal container when replaying a mount - #38391
Open
omerfarukgurbuz wants to merge 1 commit into
Open
omerfarukgurbuz wants to merge 1 commit into
omerfarukgurbuz wants to merge 1 commit into
Conversation
Author
|
Could someone from the React team approve the CI workflows when they have a chance? Thanks! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #38389. A portal fiber gets its host container when it is created. If the portal's own child suspends during a transition, React can replay the mounting fiber. Resetting its state node at that point loses the container before the portal can push it again.
Keep the portal state node across the mount reset. The regression test resolves a context consumer as the portal child and checks both where it renders and what a sibling outside two nested providers reads.
How did you test this change?
On GitHub Codespaces, the new test failed against
92bb0678c5with a nullcontainerInforead and unexpected context pops. With the fix:yarn test ReactDOMFiber-test --runInBandand its--prodvariant each passed all 38 tests.yarn test --maxWorkers=2 --testTimeout=30000passed all 324 suites (6,828 passed, 23 skipped). On the first full run a React Flight garbage-collection test reached Jest's five-second timeout. It passed in isolation at the original timeout before the full rerun.yarn test --prod --maxWorkers=2 --testTimeout=30000passed all 324 suites (6,813 passed, 22 skipped).yarn prettier-check allandyarn lintpassed.yarn flow dom-nodereported no errors.