From 9a968b20631aa887da9924de89774260d02efa76 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Tue, 17 Dec 2024 18:25:47 -0700 Subject: [PATCH] fix: added fallback source route to prerender manifest (#74052) When serving partial generated shells, the prerender manifest needs to annotate which source file is associated with the given route. This adds the new field for dynamic routes. --- packages/next/src/build/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/next/src/build/index.ts b/packages/next/src/build/index.ts index 117548d8d3d1d..693b475b33a1d 100644 --- a/packages/next/src/build/index.ts +++ b/packages/next/src/build/index.ts @@ -293,6 +293,12 @@ export interface DynamicSsgRoute { */ fallbackRootParams: readonly string[] | undefined + /** + * The source route that this fallback route is based on. This is a reference + * so that we can associate this dynamic route with the correct source. + */ + fallbackSourceRoute: string | undefined + prefetchDataRoute: string | null | undefined prefetchDataRouteRegex: string | null | undefined routeRegex: string @@ -3181,6 +3187,9 @@ export default async function build( fallbackStatus: meta.status, fallbackHeaders: meta.headers, fallbackRootParams: route.fallbackRootParams, + fallbackSourceRoute: route.fallbackRouteParams?.length + ? page + : undefined, dataRouteRegex: !dataRoute ? null : normalizeRouteRegex( @@ -3608,6 +3617,7 @@ export default async function build( ? `${normalizedRoute}.html` : false, fallbackRevalidate: undefined, + fallbackSourceRoute: undefined, fallbackRootParams: undefined, dataRouteRegex: normalizeRouteRegex( getNamedRouteRegex(