From 8af35a5feae0bea0d0943d01dc9d2442820d65ab Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Thu, 26 Sep 2024 09:57:08 -0700 Subject: [PATCH] feat: added fallback shell debugging --- packages/next/src/server/base-server.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/next/src/server/base-server.ts b/packages/next/src/server/base-server.ts index 534fe45b83545..22935ef81c58e 100644 --- a/packages/next/src/server/base-server.ts +++ b/packages/next/src/server/base-server.ts @@ -2082,6 +2082,11 @@ export default abstract class Server< typeof query.__nextppronly !== 'undefined' && couldSupportPPR + // When enabled, this will allow the use of the `?__nextppronly` query + // to enable debugging of the fallback shell. + const hasDebugFallbackShellQuery = + hasDebugStaticShellQuery && query.__nextppronly === 'fallback' + // This page supports PPR if it is marked as being `PARTIALLY_STATIC` in the // prerender manifest and this is an app page. const isRoutePPREnabled: boolean = @@ -2106,6 +2111,8 @@ export default abstract class Server< const isDebugDynamicAccesses = isDebugStaticShell && this.renderOpts.dev === true + const isDebugFallbackShell = hasDebugFallbackShellQuery && isRoutePPREnabled + // If we're in minimal mode, then try to get the postponed information from // the request metadata. If available, use it for resuming the postponed // render. @@ -2974,7 +2981,8 @@ export default abstract class Server< const fallbackRouteParams = isDynamic && isRoutePPREnabled && - getRequestMeta(req, 'didSetDefaultRouteMatches') + (getRequestMeta(req, 'didSetDefaultRouteMatches') || + isDebugFallbackShell) ? getFallbackRouteParams(pathname) : null