Skip to content

Conversation

@sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Jul 30, 2025

This keeps a data structure of Suspense boundaries and the root which can keep track which boundaries might participate in a loading sequence and everything that suspends them. This will power the Suspense tab.

Now when you select a <Suspense> boundary the "suspended by" section shows the whole boundary instead of just that component.

In the future, we'll likely need to add "Activity" boundaries to this tree as well, so that we can track what suspended the root of an Activity when filtering a subtree. Similar to how the root SuspenseNode now tracks suspending at the root. Maybe it's ok to just traverse to collect this information on-demand when you select one though since this doesn't contribute to the deduping.

We'll also need to add implicit Suspense boundaries for the rows of a SuspenseList with tail=hidden/collapsed.

…w set

Avoids thrashing the parent set when we're really just readding the same thing.
If you're awaiting the same resource in multiple places we only need to
show it once per Suspense boundary and if another parent boundary
already awaits it but using a different await then it should dedupe in the
child.
There are many suspense boundaries that never have anything that suspend
them or even if they do, the same data is also suspending a parent anyway
so in effect they never can contribute to the loading sequence.

This tracks the first time we add a unique io to a boundary or the first
time a parent removes an io which then makes a child the unique suspender.

We never return to set this to false if it ever had unique suspenders even
if it doesn't now.
@sebmarkbage sebmarkbage requested review from eps1lon and hoxyq July 30, 2025 04:10
@meta-cla meta-cla bot added the CLA Signed label Jul 30, 2025
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Jul 30, 2025
@sebmarkbage sebmarkbage merged commit dcf2a6f into facebook:main Jul 30, 2025
248 checks passed
sebmarkbage added a commit that referenced this pull request Jul 30, 2025
Follow up to #34050.

It's not actually possible to suspend *above* the root since even if you
suspend in the first child position, you're still suspending the
HostRoot which always has a corresponding FiberInstance and
SuspenseNode.
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.

2 participants