@@ -3243,11 +3243,16 @@ async function renderWithRestartOnCacheMissInDev(
32433243 // where sync IO does not cause aborts, so it's okay if it happens before render.
32443244 const initialRscPayload = await getPayload ( requestStore )
32453245
3246+ console . log ( '##########################################################' )
3247+ console . log ( `[app-render] :: rendering ${ requestStore . url . pathname } ` )
32463248 const maybeInitialServerStream = await workUnitAsyncStorage . run (
32473249 requestStore ,
32483250 ( ) =>
32493251 pipelineInSequentialTasks (
32503252 ( ) => {
3253+ console . log (
3254+ '=================== [initial] Static ==================='
3255+ )
32513256 // Static stage
32523257 initialStageController . advanceStage ( RenderStage . Static )
32533258
@@ -3285,6 +3290,9 @@ async function renderWithRestartOnCacheMissInDev(
32853290
32863291 if ( initialStageController . currentStage === RenderStage . Abandoned ) {
32873292 // If we abandoned the render in the static stage, we won't proceed further.
3293+ console . log (
3294+ '[app-render] initial render was abandoned due to sync IO in the static stage'
3295+ )
32883296 return null
32893297 }
32903298
@@ -3296,10 +3304,17 @@ async function renderWithRestartOnCacheMissInDev(
32963304 // Regardless of whether we are going to abandon this
32973305 // render we need the unblock runtime b/c it's essential
32983306 // filling caches.
3307+ console . log (
3308+ '[app-render] abandoning initial render due to a cache miss in the static stage'
3309+ )
32993310 initialStageController . abandonRender ( )
33003311 return null
33013312 }
33023313
3314+ console . log (
3315+ '=================== [initial] Runtime ==================='
3316+ )
3317+
33033318 initialStageController . advanceStage ( RenderStage . Runtime )
33043319 return stream
33053320 } ,
@@ -3309,6 +3324,14 @@ async function renderWithRestartOnCacheMissInDev(
33093324 stream === null ||
33103325 initialStageController . currentStage === RenderStage . Abandoned
33113326 ) {
3327+ if (
3328+ stream !== null &&
3329+ initialStageController . currentStage === RenderStage . Abandoned
3330+ ) {
3331+ console . log (
3332+ '[app-render] initial render was abandoned due to sync IO in the runtime stage'
3333+ )
3334+ }
33123335 // If we abandoned the render in the static or runtime stage, we won't proceed further.
33133336 return null
33143337 }
@@ -3318,10 +3341,16 @@ async function renderWithRestartOnCacheMissInDev(
33183341 // We won't advance the stage, and thus leave dynamic APIs hanging,
33193342 // because they won't be cached anyway, so it'd be wasted work.
33203343 if ( cacheSignal . hasPendingReads ( ) ) {
3344+ console . log (
3345+ '[app-render] abandoning initial render due to a cache miss in the runtime stage'
3346+ )
33213347 initialStageController . abandonRender ( )
33223348 return null
33233349 }
33243350
3351+ console . log (
3352+ '=================== [initial] Dynamic ==================='
3353+ )
33253354 // Regardless of whether we are going to abandon this
33263355 // render we need the unblock runtime b/c it's essential
33273356 // filling caches.
@@ -3364,6 +3393,8 @@ async function renderWithRestartOnCacheMissInDev(
33643393 await cacheSignal . cacheReady ( )
33653394 initialReactController . abort ( )
33663395
3396+ console . log ( '*********** restarting render ***********' )
3397+
33673398 //===============================================
33683399 // Final render (restarted)
33693400 //===============================================
@@ -3411,6 +3442,7 @@ async function renderWithRestartOnCacheMissInDev(
34113442 const finalServerStream = await workUnitAsyncStorage . run ( requestStore , ( ) =>
34123443 pipelineInSequentialTasks (
34133444 ( ) => {
3445+ console . log ( '=================== [final] Static ===================' )
34143446 // Static stage
34153447 finalStageController . advanceStage ( RenderStage . Static )
34163448
@@ -3437,11 +3469,23 @@ async function renderWithRestartOnCacheMissInDev(
34373469 return continuationStream
34383470 } ,
34393471 ( stream ) => {
3472+ if ( finalStageController . currentStage !== RenderStage . Static ) {
3473+ console . log (
3474+ `[app-render] stage was advanced to ${ RenderStage [ finalStageController . currentStage ] } before reaching the runtime stage`
3475+ )
3476+ }
3477+ console . log ( '=================== [final] Runtime ===================' )
34403478 // Runtime stage
34413479 finalStageController . advanceStage ( RenderStage . Runtime )
34423480 return stream
34433481 } ,
34443482 ( stream ) => {
3483+ if ( finalStageController . currentStage !== RenderStage . Runtime ) {
3484+ console . log (
3485+ `[app-render] stage was advanced to ${ RenderStage [ finalStageController . currentStage ] } before reaching the dynamic stage`
3486+ )
3487+ }
3488+ console . log ( '=================== [final] Dynamic ===================' )
34453489 // Dynamic stage
34463490 finalStageController . advanceStage ( RenderStage . Dynamic )
34473491 return stream
@@ -3650,6 +3694,32 @@ async function spawnStaticShellValidationInDev(
36503694 workStore,
36513695 } = ctx
36523696
3697+ {
3698+ const logChunks = ( chunks : Array < Uint8Array > ) => {
3699+ const textDecoder = new TextDecoder ( )
3700+ for ( const chunk of chunks ) {
3701+ console . log ( textDecoder . decode ( chunk ) )
3702+ }
3703+ }
3704+ console . log ( 'Static chunks' )
3705+ console . log ( '------------------------' )
3706+ logChunks ( staticServerChunks )
3707+ console . log ( '------------------------' )
3708+
3709+ console . log ( '\n' )
3710+ console . log ( 'Runtime chunks' )
3711+ console . log ( '------------------------' )
3712+ logChunks ( runtimeServerChunks . slice ( staticServerChunks . length ) )
3713+ console . log ( '------------------------' )
3714+
3715+ console . log ( '\n' )
3716+ console . log ( 'Dynamic chunks' )
3717+ console . log ( '------------------------' )
3718+ logChunks ( dynamicServerChunks . slice ( runtimeServerChunks . length ) )
3719+ console . log ( '------------------------' )
3720+ console . log ( '\n\n' )
3721+ }
3722+
36533723 const { allowEmptyStaticShell = false } = renderOpts
36543724
36553725 const rootParams = getRootParams (
0 commit comments