Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor "reappear" logic into its own traversal (#21898)
When a Suspense boundary switches to its fallback state — or similarly, when an Offscreen boundary switches from visible to hidden — we unmount all its layout effects. When it resolves — or when Offscreen switches back to visible — we mount them again. This "reappearing" logic currently happens in the same commit phase traversal where we perform normal layout effects. I've changed it so that the "reappear" logic happens in its own recurisve traversal that is separate from the commit phase one. In the next step, I will do the same for the "disappear" logic that currently lives in the `hideOrUnhideAllChildren` function. There are a few reasons to model it this way, related to future Offscreen features that we have planned. For example, we intend to provide an imperative API to "appear" and "reappear" all the effects within an Offscreen boundary. This API would be called from outside the commit phase, during an arbitrary event. Which means it can't rely on the regular commit phase — it's not part of a commit. This isn't the only motivation but it illustrates why the separation makes sense.
- Loading branch information