Skip to content

Commit 90f229d

Browse files
committed
debug logs
1 parent 9ff5927 commit 90f229d

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

packages/next/src/server/app-render/app-render.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3364,6 +3364,8 @@ async function renderWithRestartOnCacheMissInDev(
33643364
await cacheSignal.cacheReady()
33653365
initialReactController.abort()
33663366

3367+
console.log('*********** restarting render ***********')
3368+
33673369
//===============================================
33683370
// Final render (restarted)
33693371
//===============================================
@@ -3650,6 +3652,32 @@ async function spawnStaticShellValidationInDev(
36503652
workStore,
36513653
} = ctx
36523654

3655+
{
3656+
const logChunks = (chunks: Array<Uint8Array>) => {
3657+
const textDecoder = new TextDecoder()
3658+
for (const chunk of chunks) {
3659+
console.log(textDecoder.decode(chunk))
3660+
}
3661+
}
3662+
console.log('Static chunks')
3663+
console.log('------------------------')
3664+
logChunks(staticServerChunks)
3665+
console.log('------------------------')
3666+
3667+
console.log('\n')
3668+
console.log('Runtime chunks')
3669+
console.log('------------------------')
3670+
logChunks(runtimeServerChunks.slice(staticServerChunks.length))
3671+
console.log('------------------------')
3672+
3673+
console.log('\n')
3674+
console.log('Dynamic chunks')
3675+
console.log('------------------------')
3676+
logChunks(dynamicServerChunks.slice(runtimeServerChunks.length))
3677+
console.log('------------------------')
3678+
console.log('\n\n')
3679+
}
3680+
36533681
const { allowEmptyStaticShell = false } = renderOpts
36543682

36553683
const rootParams = getRootParams(

packages/next/src/server/app-render/staged-rendering.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,23 @@ export class StagedRenderingController {
8686
// so we want a slightly different flow.
8787
// See the implementation of `abandonRenderImpl` for more explanation.
8888
if (this.mayAbandon) {
89+
console.log(
90+
'========= initial render: abandoning due to sync IO ========='
91+
)
92+
console.log(
93+
`current stage: ${RenderStage[this.currentStage]}, error: ${reason.message}`
94+
)
8995
return this.abandonRenderImpl()
9096
}
9197

9298
// If we're in the final render, we cannot abandon it. We need to advance to the Dynamic stage
9399
// and capture the interruption reason.
100+
console.log(
101+
'========= final render: advancing stage to Dynamic due to sync IO ========='
102+
)
103+
console.log(
104+
`current stage: ${RenderStage[this.currentStage]}, error: ${reason.message}`
105+
)
94106
switch (this.currentStage) {
95107
case RenderStage.Static: {
96108
this.staticInterruptReason = reason

0 commit comments

Comments
 (0)