Skip to content

Commit 7b7a2de

Browse files
committed
fix: only revalidate manually or when ODB revalidates
1 parent 70b73d8 commit 7b7a2de

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

packages/runtime/src/templates/server.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { PrerenderManifest } from 'next/dist/build'
22
import type { BaseNextResponse } from 'next/dist/server/base-http'
3-
import { NodeRequestHandler, Options } from 'next/dist/server/next-server'
3+
import type { NodeRequestHandler, Options } from 'next/dist/server/next-server'
44

55
import {
66
netlifyApiFetch,
@@ -54,17 +54,10 @@ const getNetlifyNextServer = (NextServer: NextServerType) => {
5454
return
5555
}
5656

57-
// intercept requests for initial ISR renders and return static content
58-
// (we need to do this manually because we disable the Next.js cache)
59-
if (headers['x-nf-builder-cache'] === 'miss') {
60-
const pagePath = this.getPagePath(url, this.nextConfig.i18n?.locales)
61-
return this.serveStatic(req, res, pagePath)
62-
}
63-
6457
// force all standard requests to revalidate so that we always have fresh content
6558
// (we handle caching with ODBs instead of stale-while-revalidate)
6659
// eslint-disable-next-line no-underscore-dangle
67-
if (!headers.__prerender_bypass) {
60+
if (headers['x-nf-builder-cache'] === 'revalidate' && !headers.__prerender_bypass) {
6861
headers['x-prerender-revalidate'] = this.renderOpts.previewProps.previewModeId
6962
}
7063

0 commit comments

Comments
 (0)