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 { ...@@ -234,6 +234,11 @@ export interface AdapterOutput {
* renderingMode signals PPR or not for a prerender * renderingMode signals PPR or not for a prerender
*/ */
renderingMode?: RenderingMode 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 * bypassToken is the generated token that signals a prerender cache
...@@ -1205,6 +1210,7 @@ export async function handleBuildComplete({ ...@@ -1205,6 +1210,7 @@ export async function handleBuildComplete({
config: { config: {
...initialOutput.config, ...initialOutput.config,
bypassFor: undefined, bypassFor: undefined,
partialFallback: undefined,
}, },
fallback: { fallback: {
...@@ -1583,6 +1589,11 @@ export async function handleBuildComplete({ ...@@ -1583,6 +1589,11 @@ export async function handleBuildComplete({
(item) => item.page === dynamicRoute (item) => item.page === dynamicRoute
)?.routeKeys || {} )?.routeKeys || {}
) )
const partialFallback =
isAppPage &&
renderingMode === RenderingMode.PARTIALLY_STATIC &&
typeof fallback === 'string' &&
Boolean(meta.postponed)
let htmlAllowQuery = allowQuery let htmlAllowQuery = allowQuery
// We only want to vary on the shell contents if there is a fallback // We only want to vary on the shell contents if there is a fallback
...@@ -1642,6 +1653,7 @@ export async function handleBuildComplete({ ...@@ -1642,6 +1653,7 @@ export async function handleBuildComplete({
allowQuery: htmlAllowQuery, allowQuery: htmlAllowQuery,
allowHeader, allowHeader,
renderingMode, renderingMode,
partialFallback: partialFallback || undefined,
bypassFor: isAppPage ? experimentalBypassFor : undefined, bypassFor: isAppPage ? experimentalBypassFor : undefined,
bypassToken: prerenderManifest.preview.previewModeId, bypassToken: prerenderManifest.preview.previewModeId,
}, },
...@@ -1720,6 +1732,7 @@ export async function handleBuildComplete({ ...@@ -1720,6 +1732,7 @@ export async function handleBuildComplete({
config: { config: {
...initialOutput.config, ...initialOutput.config,
allowQuery: dataAllowQuery, allowQuery: dataAllowQuery,
partialFallback: undefined,
}, },
}) })
} else if (dataRoute) { } else if (dataRoute) {
...@@ -1728,6 +1741,10 @@ export async function handleBuildComplete({ ...@@ -1728,6 +1741,10 @@ export async function handleBuildComplete({
id: dataRoute, id: dataRoute,
pathname: dataRoute, pathname: dataRoute,
fallback: undefined, fallback: undefined,
config: {
...initialOutput.config,
partialFallback: undefined,
},
}) })
} }
prerenderGroupId += 1 prerenderGroupId += 1
...@@ -1787,6 +1804,10 @@ export async function handleBuildComplete({ ...@@ -1787,6 +1804,10 @@ export async function handleBuildComplete({
pathname: dataPathname, pathname: dataPathname,
// data route doesn't have skeleton fallback // data route doesn't have skeleton fallback
fallback: undefined, fallback: undefined,
config: {
...initialOutput.config,
partialFallback: undefined,
},
groupId: prerenderGroupId, 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