Skip to content

Commit

Permalink
Refactor "reappear" logic into its own traversal (#21898)
Browse files Browse the repository at this point in the history
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
acdlite authored Jul 16, 2021
1 parent 3101872 commit 34600f4
Show file tree
Hide file tree
Showing 3 changed files with 458 additions and 368 deletions.
Loading

0 comments on commit 34600f4

Please sign in to comment.