Unverified Commit 1c9577e3 authored by Zack Tanner's avatar Zack Tanner Committed by GitHub

partial fallbacks: add adapter flag (#90395)

Plumbs the new `partialFallback` through `onBuildComplete`, which is
consumed by `adapter-vercel` to signal that a prerender is a partial
fallback (PR forthcoming, once this lands, so it's available on the
types). For more information on what a partial fallback is, see the
downstack PR.
parent 9ff3b7c4
......@@ -234,6 +234,11 @@ export interface AdapterOutput {
* renderingMode signals PPR or not for a prerender
*/
renderingMode?: RenderingMode
/**
* partialFallback signals this prerender serves a partial fallback shell
* and should be upgraded to a full route in the background.
*/
partialFallback?: boolean
/**
* bypassToken is the generated token that signals a prerender cache
......@@ -1205,6 +1210,7 @@ export async function handleBuildComplete({
config: {
...initialOutput.config,
bypassFor: undefined,
partialFallback: undefined,
},
fallback: {
......@@ -1583,6 +1589,11 @@ export async function handleBuildComplete({
(item) => item.page === dynamicRoute
)?.routeKeys || {}
)
const partialFallback =
isAppPage &&
renderingMode === RenderingMode.PARTIALLY_STATIC &&
typeof fallback === 'string' &&
Boolean(meta.postponed)
let htmlAllowQuery = allowQuery
// We only want to vary on the shell contents if there is a fallback
......@@ -1642,6 +1653,7 @@ export async function handleBuildComplete({
allowQuery: htmlAllowQuery,
allowHeader,
renderingMode,
partialFallback: partialFallback || undefined,
bypassFor: isAppPage ? experimentalBypassFor : undefined,
bypassToken: prerenderManifest.preview.previewModeId,
},
......@@ -1720,6 +1732,7 @@ export async function handleBuildComplete({
config: {
...initialOutput.config,
allowQuery: dataAllowQuery,
partialFallback: undefined,
},
})
} else if (dataRoute) {
......@@ -1728,6 +1741,10 @@ export async function handleBuildComplete({
id: dataRoute,
pathname: dataRoute,
fallback: undefined,
config: {
...initialOutput.config,
partialFallback: undefined,
},
})
}
prerenderGroupId += 1
......@@ -1787,6 +1804,10 @@ export async function handleBuildComplete({
pathname: dataPathname,
// data route doesn't have skeleton fallback
fallback: undefined,
config: {
...initialOutput.config,
partialFallback: undefined,
},
groupId: prerenderGroupId,
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment