Skip to content

Commit

Permalink
[next] provide experimentalBypassFor to prerender from manifest (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner authored Sep 12, 2023
1 parent 2f461a8 commit 7a0fed9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-bags-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@vercel/next": patch
---

provide `experimentalBypassFor` to Prerender from manifest
8 changes: 8 additions & 0 deletions packages/next/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,7 @@ export type NextPrerenderedRoutes = {
srcRoute: string | null;
initialStatus?: number;
initialHeaders?: Record<string, string>;
experimentalBypassFor?: HasField;
};
};

Expand Down Expand Up @@ -1084,6 +1085,7 @@ export async function getPrerenderManifest(
dataRoute: string | null;
initialStatus?: number;
initialHeaders?: Record<string, string>;
experimentalBypassFor?: HasField;
};
};
dynamicRoutes: {
Expand Down Expand Up @@ -1177,10 +1179,12 @@ export async function getPrerenderManifest(

let initialStatus: undefined | number;
let initialHeaders: undefined | Record<string, string>;
let experimentalBypassFor: undefined | HasField;

if (manifest.version === 4) {
initialStatus = manifest.routes[route].initialStatus;
initialHeaders = manifest.routes[route].initialHeaders;
experimentalBypassFor = manifest.routes[route].experimentalBypassFor;
}

ret.staticRoutes[route] = {
Expand All @@ -1192,6 +1196,7 @@ export async function getPrerenderManifest(
srcRoute,
initialStatus,
initialHeaders,
experimentalBypassFor,
};
});

Expand Down Expand Up @@ -1909,6 +1914,7 @@ export const onPrerenderRoute =
let dataRoute: string | null;
let initialStatus: number | undefined;
let initialHeaders: Record<string, string> | undefined;
let experimentalBypassFor: HasField | undefined;

if (isFallback || isBlocking) {
const pr = isFallback
Expand Down Expand Up @@ -1937,6 +1943,7 @@ export const onPrerenderRoute =
dataRoute,
initialHeaders,
initialStatus,
experimentalBypassFor,
} = pr);
}

Expand Down Expand Up @@ -2177,6 +2184,7 @@ export const onPrerenderRoute =
fallback: htmlFsRef,
group: prerenderGroup,
bypassToken: prerenderManifest.bypassToken,
experimentalBypassFor,
initialStatus,
initialHeaders,
sourcePath,
Expand Down

0 comments on commit 7a0fed9

Please sign in to comment.