Skip to content

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Aug 13, 2025

The Fibers of dehydrated Suspense boundaries have no child Offscreen Fiber (yet).

We now handle newly hydrated boundaries in the mount and update path.

This doesn't handle Activity yet which also doesn't have children when dehydrated yet.

Stacked on #34199

@meta-cla meta-cla bot added the CLA Signed label Aug 13, 2025
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Aug 13, 2025
@eps1lon eps1lon requested a review from sebmarkbage August 13, 2025 12:52
@eps1lon eps1lon marked this pull request as ready for review August 13, 2025 12:52
@eps1lon eps1lon force-pushed the sebbie/dehydrate-suspense branch 2 times, most recently from 80efaa4 to 3a14dff Compare August 15, 2025 10:30
@react-sizebot
Copy link

react-sizebot commented Aug 15, 2025

Comparing: 431bb0b...223a52c

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 530.18 kB 530.18 kB = 93.39 kB 93.39 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 655.81 kB 655.81 kB = 115.30 kB 115.30 kB
facebook-www/ReactDOM-prod.classic.js = 675.58 kB 675.58 kB = 118.54 kB 118.54 kB
facebook-www/ReactDOM-prod.modern.js = 666.00 kB 666.00 kB = 116.87 kB 116.86 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 223a52c

@eps1lon eps1lon requested a review from sebmarkbage August 15, 2025 12:17
return !rootState.isDehydrated;
case SuspenseComponent:
const suspenseState = fiber.memoizedState;
return suspenseState === null || suspenseState.dehydrated === null;
Copy link
Collaborator

@sebmarkbage sebmarkbage Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe you should do == null to cover the case for code before we added the dehydrated property, other suspended in older React versions will be treated as dehydrated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought checking for OffscreenComponent earlier ensures this is only checked for modern Suspense? Or is the dehydrated in #16346 not always set for modern Suspense?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, this is only handling dehydrated boundaries for modern Suspense. I haven't checked yet how dehydrated Suspense is handled in legacy Suspense.

@eps1lon eps1lon force-pushed the sebbie/dehydrate-suspense branch from a2e851e to 223a52c Compare August 16, 2025 08:27
@@ -1796,7 +1796,7 @@ function updateHostRoot(
}

const nextProps = workInProgress.pendingProps;
const prevState = workInProgress.memoizedState;
const prevState: RootState = workInProgress.memoizedState;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by when I looked through existing usages of memoized state of HostRoot. memoizedState is any by default so this just increases Flow coverage.

@eps1lon eps1lon merged commit 2cb8edb into facebook:main Aug 16, 2025
240 of 241 checks passed
@eps1lon eps1lon deleted the sebbie/dehydrate-suspense branch August 16, 2025 08:34
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.

3 participants