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> =
}
const nextFontManifest = maybeJSONParse(self.__NEXT_FONT_MANIFEST)
globalThis.__next_private_global_wait_until__ = []
const render = getRender({
pagesType,
dev: ${dev},
......@@ -255,12 +257,22 @@ const edgeSSRLoader: webpack.LoaderDefinitionFunction<EdgeSSRLoaderQuery> =
export const ComponentMod = pageMod
export default function(opts) {
return adapter({
export default async function(opts, event) {
const res = await adapter({
...opts,
IncrementalCache,
handler: render
})
if (event && event.waitUntil) {
event.waitUntil(
Promise.all(
[res?.waitUntil, ...globalThis.__next_private_global_wait_until__]
)
)
}
return res
}`
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