@@ -96,7 +96,6 @@ import {
96
96
disableModulePatternComponents ,
97
97
enableProfilerCommitHooks ,
98
98
enableProfilerTimer ,
99
- enableSuspenseServerRenderer ,
100
99
warnAboutDefaultPropsOnFunctionComponents ,
101
100
enableScopeAPI ,
102
101
enableCache ,
@@ -2134,17 +2133,15 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
2134
2133
// If we're currently hydrating, try to hydrate this boundary.
2135
2134
tryToClaimNextHydratableInstance ( workInProgress ) ;
2136
2135
// This could've been a dehydrated suspense component.
2137
- if ( enableSuspenseServerRenderer ) {
2138
- const suspenseState : null | SuspenseState = workInProgress . memoizedState ;
2139
- if ( suspenseState !== null ) {
2140
- const dehydrated = suspenseState . dehydrated ;
2141
- if ( dehydrated !== null ) {
2142
- return mountDehydratedSuspenseComponent (
2143
- workInProgress ,
2144
- dehydrated ,
2145
- renderLanes ,
2146
- ) ;
2147
- }
2136
+ const suspenseState : null | SuspenseState = workInProgress . memoizedState ;
2137
+ if ( suspenseState !== null ) {
2138
+ const dehydrated = suspenseState . dehydrated ;
2139
+ if ( dehydrated !== null ) {
2140
+ return mountDehydratedSuspenseComponent (
2141
+ workInProgress ,
2142
+ dehydrated ,
2143
+ renderLanes ,
2144
+ ) ;
2148
2145
}
2149
2146
}
2150
2147
@@ -2220,59 +2217,57 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
2220
2217
// The current tree is already showing a fallback
2221
2218
2222
2219
// Special path for hydration
2223
- if ( enableSuspenseServerRenderer ) {
2224
- const dehydrated = prevState . dehydrated ;
2225
- if ( dehydrated !== null ) {
2226
- if ( ! didSuspend ) {
2227
- return updateDehydratedSuspenseComponent (
2228
- current ,
2229
- workInProgress ,
2230
- dehydrated ,
2231
- prevState ,
2232
- renderLanes ,
2233
- ) ;
2234
- } else if ( workInProgress . flags & ForceClientRender ) {
2235
- // Something errored during hydration. Try again without hydrating.
2236
- workInProgress . flags &= ~ ForceClientRender ;
2237
- return retrySuspenseComponentWithoutHydrating (
2238
- current ,
2239
- workInProgress ,
2240
- renderLanes ,
2241
- new Error (
2242
- 'There was an error while hydrating this Suspense boundary. ' +
2243
- 'Switched to client rendering.' ,
2244
- ) ,
2245
- ) ;
2246
- } else if (
2247
- ( workInProgress . memoizedState : null | SuspenseState ) !== null
2248
- ) {
2249
- // Something suspended and we should still be in dehydrated mode.
2250
- // Leave the existing child in place.
2251
- workInProgress . child = current . child ;
2252
- // The dehydrated completion pass expects this flag to be there
2253
- // but the normal suspense pass doesn't.
2254
- workInProgress . flags |= DidCapture ;
2255
- return null ;
2256
- } else {
2257
- // Suspended but we should no longer be in dehydrated mode.
2258
- // Therefore we now have to render the fallback.
2259
- renderDidSuspendDelayIfPossible ( ) ;
2260
- const nextPrimaryChildren = nextProps . children ;
2261
- const nextFallbackChildren = nextProps . fallback ;
2262
- const fallbackChildFragment = mountSuspenseFallbackAfterRetryWithoutHydrating (
2263
- current ,
2264
- workInProgress ,
2265
- nextPrimaryChildren ,
2266
- nextFallbackChildren ,
2267
- renderLanes ,
2268
- ) ;
2269
- const primaryChildFragment : Fiber = ( workInProgress . child : any ) ;
2270
- primaryChildFragment . memoizedState = mountSuspenseOffscreenState (
2271
- renderLanes ,
2272
- ) ;
2273
- workInProgress . memoizedState = SUSPENDED_MARKER ;
2274
- return fallbackChildFragment ;
2275
- }
2220
+ const dehydrated = prevState . dehydrated ;
2221
+ if ( dehydrated !== null ) {
2222
+ if ( ! didSuspend ) {
2223
+ return updateDehydratedSuspenseComponent (
2224
+ current ,
2225
+ workInProgress ,
2226
+ dehydrated ,
2227
+ prevState ,
2228
+ renderLanes ,
2229
+ ) ;
2230
+ } else if ( workInProgress . flags & ForceClientRender ) {
2231
+ // Something errored during hydration. Try again without hydrating.
2232
+ workInProgress . flags &= ~ ForceClientRender ;
2233
+ return retrySuspenseComponentWithoutHydrating (
2234
+ current ,
2235
+ workInProgress ,
2236
+ renderLanes ,
2237
+ new Error (
2238
+ 'There was an error while hydrating this Suspense boundary. ' +
2239
+ 'Switched to client rendering.' ,
2240
+ ) ,
2241
+ ) ;
2242
+ } else if (
2243
+ ( workInProgress . memoizedState : null | SuspenseState ) !== null
2244
+ ) {
2245
+ // Something suspended and we should still be in dehydrated mode.
2246
+ // Leave the existing child in place.
2247
+ workInProgress . child = current . child ;
2248
+ // The dehydrated completion pass expects this flag to be there
2249
+ // but the normal suspense pass doesn't.
2250
+ workInProgress . flags |= DidCapture ;
2251
+ return null ;
2252
+ } else {
2253
+ // Suspended but we should no longer be in dehydrated mode.
2254
+ // Therefore we now have to render the fallback.
2255
+ renderDidSuspendDelayIfPossible ( ) ;
2256
+ const nextPrimaryChildren = nextProps . children ;
2257
+ const nextFallbackChildren = nextProps . fallback ;
2258
+ const fallbackChildFragment = mountSuspenseFallbackAfterRetryWithoutHydrating (
2259
+ current ,
2260
+ workInProgress ,
2261
+ nextPrimaryChildren ,
2262
+ nextFallbackChildren ,
2263
+ renderLanes ,
2264
+ ) ;
2265
+ const primaryChildFragment : Fiber = ( workInProgress . child : any ) ;
2266
+ primaryChildFragment . memoizedState = mountSuspenseOffscreenState (
2267
+ renderLanes ,
2268
+ ) ;
2269
+ workInProgress . memoizedState = SUSPENDED_MARKER ;
2270
+ return fallbackChildFragment ;
2276
2271
}
2277
2272
}
2278
2273
@@ -3657,20 +3652,18 @@ function attemptEarlyBailoutIfNoScheduledUpdate(
3657
3652
case SuspenseComponent : {
3658
3653
const state : SuspenseState | null = workInProgress . memoizedState ;
3659
3654
if ( state !== null ) {
3660
- if ( enableSuspenseServerRenderer ) {
3661
- if ( state . dehydrated !== null ) {
3662
- pushSuspenseContext (
3663
- workInProgress ,
3664
- setDefaultShallowSuspenseContext ( suspenseStackCursor . current ) ,
3665
- ) ;
3666
- // We know that this component will suspend again because if it has
3667
- // been unsuspended it has committed as a resolved Suspense component.
3668
- // If it needs to be retried, it should have work scheduled on it.
3669
- workInProgress . flags |= DidCapture ;
3670
- // We should never render the children of a dehydrated boundary until we
3671
- // upgrade it. We return null instead of bailoutOnAlreadyFinishedWork.
3672
- return null ;
3673
- }
3655
+ if ( state . dehydrated !== null ) {
3656
+ pushSuspenseContext (
3657
+ workInProgress ,
3658
+ setDefaultShallowSuspenseContext ( suspenseStackCursor . current ) ,
3659
+ ) ;
3660
+ // We know that this component will suspend again because if it has
3661
+ // been unsuspended it has committed as a resolved Suspense component.
3662
+ // If it needs to be retried, it should have work scheduled on it.
3663
+ workInProgress . flags |= DidCapture ;
3664
+ // We should never render the children of a dehydrated boundary until we
3665
+ // upgrade it. We return null instead of bailoutOnAlreadyFinishedWork.
3666
+ return null ;
3674
3667
}
3675
3668
3676
3669
// If this boundary is currently timed out, we need to decide
0 commit comments