Unverified Commit b7c85b87 authored by Shu Ding's avatar Shu Ding Committed by GitHub

Expose util internally for debugging (#56381)

This PR exposes a temporary `__next_private_global_wait_until__` globally for Edge SSR's function context to do `waitUntil`.
parent 515784c2
...@@ -225,6 +225,8 @@ const edgeSSRLoader: webpack.LoaderDefinitionFunction<EdgeSSRLoaderQuery> = ...@@ -225,6 +225,8 @@ const edgeSSRLoader: webpack.LoaderDefinitionFunction<EdgeSSRLoaderQuery> =
} }
const nextFontManifest = maybeJSONParse(self.__NEXT_FONT_MANIFEST) const nextFontManifest = maybeJSONParse(self.__NEXT_FONT_MANIFEST)
globalThis.__next_private_global_wait_until__ = []
const render = getRender({ const render = getRender({
pagesType, pagesType,
dev: ${dev}, dev: ${dev},
...@@ -255,12 +257,22 @@ const edgeSSRLoader: webpack.LoaderDefinitionFunction<EdgeSSRLoaderQuery> = ...@@ -255,12 +257,22 @@ const edgeSSRLoader: webpack.LoaderDefinitionFunction<EdgeSSRLoaderQuery> =
export const ComponentMod = pageMod export const ComponentMod = pageMod
export default function(opts) { export default async function(opts, event) {
return adapter({ const res = await adapter({
...opts, ...opts,
IncrementalCache, IncrementalCache,
handler: render handler: render
}) })
if (event && event.waitUntil) {
event.waitUntil(
Promise.all(
[res?.waitUntil, ...globalThis.__next_private_global_wait_until__]
)
)
}
return res
}` }`
return transformed return transformed
......
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