@@ -3248,6 +3248,9 @@ async function renderWithRestartOnCacheMissInDev(
32483248 ( ) =>
32493249 pipelineInSequentialTasks (
32503250 ( ) => {
3251+ console . log (
3252+ '=================== [initial] Static ==================='
3253+ )
32513254 // Static stage
32523255 initialStageController . advanceStage ( RenderStage . Static )
32533256
@@ -3285,6 +3288,9 @@ async function renderWithRestartOnCacheMissInDev(
32853288
32863289 if ( initialStageController . currentStage === RenderStage . Abandoned ) {
32873290 // If we abandoned the render in the static stage, we won't proceed further.
3291+ console . log (
3292+ '[app-render] initial render was abandoned due to sync IO in the static stage'
3293+ )
32883294 return null
32893295 }
32903296
@@ -3296,10 +3302,17 @@ async function renderWithRestartOnCacheMissInDev(
32963302 // Regardless of whether we are going to abandon this
32973303 // render we need the unblock runtime b/c it's essential
32983304 // filling caches.
3305+ console . log (
3306+ '[app-render] abandoning initial render due to a cache miss in the static stage'
3307+ )
32993308 initialStageController . abandonRender ( )
33003309 return null
33013310 }
33023311
3312+ console . log (
3313+ '=================== [initial] Runtime ==================='
3314+ )
3315+
33033316 initialStageController . advanceStage ( RenderStage . Runtime )
33043317 return stream
33053318 } ,
@@ -3309,6 +3322,14 @@ async function renderWithRestartOnCacheMissInDev(
33093322 stream === null ||
33103323 initialStageController . currentStage === RenderStage . Abandoned
33113324 ) {
3325+ if (
3326+ stream !== null &&
3327+ initialStageController . currentStage === RenderStage . Abandoned
3328+ ) {
3329+ console . log (
3330+ '[app-render] initial render was abandoned due to sync IO in the runtime stage'
3331+ )
3332+ }
33123333 // If we abandoned the render in the static or runtime stage, we won't proceed further.
33133334 return null
33143335 }
@@ -3318,10 +3339,16 @@ async function renderWithRestartOnCacheMissInDev(
33183339 // We won't advance the stage, and thus leave dynamic APIs hanging,
33193340 // because they won't be cached anyway, so it'd be wasted work.
33203341 if ( cacheSignal . hasPendingReads ( ) ) {
3342+ console . log (
3343+ '[app-render] abandoning initial render due to a cache miss in the runtime stage'
3344+ )
33213345 initialStageController . abandonRender ( )
33223346 return null
33233347 }
33243348
3349+ console . log (
3350+ '=================== [initial] Dynamic ==================='
3351+ )
33253352 // Regardless of whether we are going to abandon this
33263353 // render we need the unblock runtime b/c it's essential
33273354 // filling caches.
@@ -3364,6 +3391,8 @@ async function renderWithRestartOnCacheMissInDev(
33643391 await cacheSignal . cacheReady ( )
33653392 initialReactController . abort ( )
33663393
3394+ console . log ( '*********** restarting render ***********' )
3395+
33673396 //===============================================
33683397 // Final render (restarted)
33693398 //===============================================
@@ -3411,6 +3440,7 @@ async function renderWithRestartOnCacheMissInDev(
34113440 const finalServerStream = await workUnitAsyncStorage . run ( requestStore , ( ) =>
34123441 pipelineInSequentialTasks (
34133442 ( ) => {
3443+ console . log ( '=================== [final] Static ===================' )
34143444 // Static stage
34153445 finalStageController . advanceStage ( RenderStage . Static )
34163446
@@ -3437,11 +3467,23 @@ async function renderWithRestartOnCacheMissInDev(
34373467 return continuationStream
34383468 } ,
34393469 ( stream ) => {
3470+ if ( finalStageController . currentStage !== RenderStage . Static ) {
3471+ console . log (
3472+ `[app-render] stage was advanced to ${ RenderStage [ finalStageController . currentStage ] } before reaching the runtime stage`
3473+ )
3474+ }
3475+ console . log ( '=================== [final] Runtime ===================' )
34403476 // Runtime stage
34413477 finalStageController . advanceStage ( RenderStage . Runtime )
34423478 return stream
34433479 } ,
34443480 ( stream ) => {
3481+ if ( finalStageController . currentStage !== RenderStage . Runtime ) {
3482+ console . log (
3483+ `[app-render] stage was advanced to ${ RenderStage [ finalStageController . currentStage ] } before reaching the dynamic stage`
3484+ )
3485+ }
3486+ console . log ( '=================== [final] Dynamic ===================' )
34453487 // Dynamic stage
34463488 finalStageController . advanceStage ( RenderStage . Dynamic )
34473489 return stream
@@ -3650,6 +3692,32 @@ async function spawnStaticShellValidationInDev(
36503692 workStore,
36513693 } = ctx
36523694
3695+ {
3696+ const logChunks = ( chunks : Array < Uint8Array > ) => {
3697+ const textDecoder = new TextDecoder ( )
3698+ for ( const chunk of chunks ) {
3699+ console . log ( textDecoder . decode ( chunk ) )
3700+ }
3701+ }
3702+ console . log ( 'Static chunks' )
3703+ console . log ( '------------------------' )
3704+ logChunks ( staticServerChunks )
3705+ console . log ( '------------------------' )
3706+
3707+ console . log ( '\n' )
3708+ console . log ( 'Runtime chunks' )
3709+ console . log ( '------------------------' )
3710+ logChunks ( runtimeServerChunks . slice ( staticServerChunks . length ) )
3711+ console . log ( '------------------------' )
3712+
3713+ console . log ( '\n' )
3714+ console . log ( 'Dynamic chunks' )
3715+ console . log ( '------------------------' )
3716+ logChunks ( dynamicServerChunks . slice ( runtimeServerChunks . length ) )
3717+ console . log ( '------------------------' )
3718+ console . log ( '\n\n' )
3719+ }
3720+
36533721 const { allowEmptyStaticShell = false } = renderOpts
36543722
36553723 const rootParams = getRootParams (
0 commit comments