diff --git a/packages/next/src/server/base-server.ts b/packages/next/src/server/base-server.ts index 0a4514e2a0e0c..b93eac09f5676 100644 --- a/packages/next/src/server/base-server.ts +++ b/packages/next/src/server/base-server.ts @@ -2385,10 +2385,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 fb17408808c98..c1e8f4171478d 100644 --- a/packages/next/src/server/render.tsx +++ b/packages/next/src/server/render.tsx @@ -1067,6 +1067,7 @@ export async function renderToHTMLImpl( }) ) canAccessRes = false + renderResultMeta.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 37037eefba08f..32b3c59d45012 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 @@ -344,12 +344,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 7c013f85e20c7..0bab6b06c5cef 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 @@ -617,12 +617,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())