diff --git a/packages/next/src/server/base-server.ts b/packages/next/src/server/base-server.ts index 8aed8efebec90..b39edf583d07e 100644 --- a/packages/next/src/server/base-server.ts +++ b/packages/next/src/server/base-server.ts @@ -2573,10 +2573,7 @@ export default abstract class Server { return { ...result, - revalidate: - result.revalidate !== undefined - ? result.revalidate - : /* default to minimum revalidate (this should be an invariant) */ 1, + revalidate: result.revalidate, } }, { diff --git a/packages/next/src/server/render.tsx b/packages/next/src/server/render.tsx index 9038d434ebcdc..2cc3e37ff2d9f 100644 --- a/packages/next/src/server/render.tsx +++ b/packages/next/src/server/render.tsx @@ -1089,6 +1089,7 @@ export async function renderToHTMLImpl( }) ) canAccessRes = false + metadata.revalidate = 0 } catch (serverSidePropsError: any) { // remove not found error code to prevent triggering legacy // 404 rendering diff --git a/test/production/standalone-mode/required-server-files/required-server-files-i18n.test.ts b/test/production/standalone-mode/required-server-files/required-server-files-i18n.test.ts index 820d81b6ffb95..b99348c689905 100644 --- a/test/production/standalone-mode/required-server-files/required-server-files-i18n.test.ts +++ b/test/production/standalone-mode/required-server-files/required-server-files-i18n.test.ts @@ -345,12 +345,16 @@ describe('required server files i18n', () => { expect(isNaN(data2.random)).toBe(false) expect(data2.random).not.toBe(data.random) - const html3 = await renderViaHTTP(appPort, '/some-other-path', undefined, { - headers: { - 'x-matched-path': '/dynamic/[slug]?slug=%5Bslug%5D.json', - 'x-now-route-matches': '1=second&nxtPslug=second', - }, - }) + const html3 = await renderViaHTTP( + appPort, + '/some-other-path?nxtPslug=second', + undefined, + { + headers: { + 'x-matched-path': '/dynamic/[slug]?slug=%5Bslug%5D.json', + }, + } + ) const $3 = cheerio.load(html3) const data3 = JSON.parse($3('#props').text()) diff --git a/test/production/standalone-mode/required-server-files/required-server-files.test.ts b/test/production/standalone-mode/required-server-files/required-server-files.test.ts index d595ff289569d..2d8c58fdee412 100644 --- a/test/production/standalone-mode/required-server-files/required-server-files.test.ts +++ b/test/production/standalone-mode/required-server-files/required-server-files.test.ts @@ -622,12 +622,16 @@ describe('required server files', () => { expect(isNaN(data2.random)).toBe(false) expect(data2.random).not.toBe(data.random) - const html3 = await renderViaHTTP(appPort, '/some-other-path', undefined, { - headers: { - 'x-matched-path': '/dynamic/[slug]', - 'x-now-route-matches': '1=second&nxtPslug=second', - }, - }) + const html3 = await renderViaHTTP( + appPort, + '/some-other-path?nxtPslug=second', + undefined, + { + headers: { + 'x-matched-path': '/dynamic/[slug]', + }, + } + ) const $3 = cheerio.load(html3) const data3 = JSON.parse($3('#props').text())