@@ -96,7 +96,6 @@ import {
9696 disableModulePatternComponents ,
9797 enableProfilerCommitHooks ,
9898 enableProfilerTimer ,
99- enableSuspenseServerRenderer ,
10099 warnAboutDefaultPropsOnFunctionComponents ,
101100 enableScopeAPI ,
102101 enableCache ,
@@ -2134,17 +2133,15 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
21342133 // If we're currently hydrating, try to hydrate this boundary.
21352134 tryToClaimNextHydratableInstance ( workInProgress ) ;
21362135 // 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+ ) ;
21482145 }
21492146 }
21502147
@@ -2220,59 +2217,57 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
22202217 // The current tree is already showing a fallback
22212218
22222219 // 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 ;
22762271 }
22772272 }
22782273
@@ -3657,20 +3652,18 @@ function attemptEarlyBailoutIfNoScheduledUpdate(
36573652 case SuspenseComponent : {
36583653 const state : SuspenseState | null = workInProgress . memoizedState ;
36593654 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 ;
36743667 }
36753668
36763669 // If this boundary is currently timed out, we need to decide
0 commit comments