From b357dea385e1c33a93fa91b2789c6884459049b9 Mon Sep 17 00:00:00 2001 From: Zack Tanner Date: Sat, 30 Sep 2023 17:00:31 -0700 Subject: [PATCH] ensure cache key is cased consistently --- .../router-reducer/create-router-cache-key.ts | 4 +++- packages/next/src/export/routes/app-page.ts | 11 +---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/packages/next/src/client/components/router-reducer/create-router-cache-key.ts b/packages/next/src/client/components/router-reducer/create-router-cache-key.ts index 8f272dc5abf24d..49101c5f7c8af5 100644 --- a/packages/next/src/client/components/router-reducer/create-router-cache-key.ts +++ b/packages/next/src/client/components/router-reducer/create-router-cache-key.ts @@ -4,9 +4,11 @@ export function createRouterCacheKey( segment: Segment, withoutSearchParameters: boolean = false ) { - return Array.isArray(segment) + const cacheKey = Array.isArray(segment) ? `${segment[0]}|${segment[1]}|${segment[2]}` : withoutSearchParameters && segment.startsWith('__PAGE__') ? '__PAGE__' : segment + + return cacheKey?.toLowerCase() } diff --git a/packages/next/src/export/routes/app-page.ts b/packages/next/src/export/routes/app-page.ts index cff16d5ca11559..02a7144aa47bd1 100644 --- a/packages/next/src/export/routes/app-page.ts +++ b/packages/next/src/export/routes/app-page.ts @@ -29,7 +29,6 @@ export async function generatePrefetchRsc( path: string, res: MockedResponse, pathname: string, - query: NextParsedUrlQuery, htmlFilepath: string, renderOpts: RenderOpts ) { @@ -41,13 +40,7 @@ export async function generatePrefetchRsc( renderOpts.isPrefetch = true delete renderOpts.isRevalidate - const prefetchRenderResult = await render( - req, - res, - pathname, - query, - renderOpts - ) + const prefetchRenderResult = await render(req, res, pathname, {}, renderOpts) prefetchRenderResult.pipe(res) await res.hasStreamed @@ -87,7 +80,6 @@ export async function exportAppPage( path, res, pathname, - query, htmlFilepath, renderOpts ) @@ -113,7 +105,6 @@ export async function exportAppPage( path, res, pathname, - query, htmlFilepath, renderOpts )