Skip to content

Commit ebc9e82

Browse files
committed
Call initializeCacheHandlers slightly later in edge
1 parent c112f8a commit ebc9e82

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

packages/next/src/build/templates/edge-ssr-app.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ declare const nextConfig: NextConfigRuntime
3333
// OPTIONAL_IMPORT:incrementalCacheHandler
3434
// INJECT:nextConfig
3535

36-
// Initialize the cache handlers interface.
37-
initializeCacheHandlers(nextConfig.cacheMaxMemorySize)
38-
3936
const maybeJSONParse = (str?: string) => (str ? JSON.parse(str) : undefined)
4037

4138
const rscManifest = self.__RSC_MANIFEST?.['VAR_PAGE']
@@ -88,6 +85,9 @@ async function requestHandler(
8885
routerServerContext,
8986
} = prepareResult
9087

88+
// Initialize the cache handlers interface.
89+
initializeCacheHandlers(nextConfig.cacheMaxMemorySize)
90+
9191
const isPossibleServerAction = getIsPossibleServerAction(req)
9292
const botType = getBotType(req.headers.get('User-Agent') || '')
9393
const { isOnDemandRevalidate } = checkIsOnDemandRevalidate(

packages/next/src/build/templates/edge-ssr.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,12 @@ declare const nextConfig: NextConfigRuntime
3535
declare const pageRouteModuleOptions: any
3636
declare const errorRouteModuleOptions: any
3737
declare const user500RouteModuleOptions: any
38-
// INJECT:nextConfig
39-
// INJECT:pageRouteModuleOptions
40-
// INJECT:errorRouteModuleOptions
41-
// INJECT:user500RouteModuleOptions
38+
// INJECT:nextConfig
39+
// INJECT:pageRouteModuleOptions
40+
// INJECT:errorRouteModuleOptions
41+
// INJECT:user500RouteModuleOptions
4242

43-
// Initialize the cache handlers interface.
44-
initializeCacheHandlers(nextConfig.cacheMaxMemorySize)
45-
46-
// expose this for the route-module
43+
// expose this for the route-module
4744
;(globalThis as any).nextConfig = nextConfig
4845

4946
const pageMod = {
@@ -119,6 +116,8 @@ async function requestHandler(
119116
dynamicCssManifest,
120117
} = prepareResult
121118

119+
initializeCacheHandlers(nextConfig.cacheMaxMemorySize)
120+
122121
const renderContext: PagesRouteHandlerContext = {
123122
page: srcPage,
124123
query,

0 commit comments

Comments
 (0)