-
Notifications
You must be signed in to change notification settings - Fork 50.2k
[DevTools] Handle dehydrated Suspense boundaries #34196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
80efaa4 to
3a14dff
Compare
|
Comparing: 431bb0b...223a52c Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
| return !rootState.isDehydrated; | ||
| case SuspenseComponent: | ||
| const suspenseState = fiber.memoizedState; | ||
| return suspenseState === null || suspenseState.dehydrated === null; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
c3971d5 to
a2e851e
Compare
a2e851e to
223a52c
Compare
|
|
||
| const nextProps = workInProgress.pendingProps; | ||
| const prevState = workInProgress.memoizedState; | ||
| const prevState: RootState = workInProgress.memoizedState; |
There was a problem hiding this comment.
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.
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