Skip to content

Commit ce82ee7

Browse files
committed
chore: add logging and comments
1 parent 7b7a2de commit ce82ee7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/runtime/src/templates/server.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const getNetlifyNextServer = (NextServer: NextServerType) => {
4242
// conditionally use the prebundled React module
4343
this.netlifyPrebundleReact(url)
4444

45-
// intercept on-demand revalidation requests and handler with the Netlify API
45+
// intercept on-demand revalidation requests and handle with the Netlify API
4646
if (headers['x-prerender-revalidate'] && this.netlifyConfig.revalidateToken) {
4747
// handle on-demand revalidation by purging the ODB cache
4848
await this.netlifyRevalidate(url)
@@ -54,10 +54,11 @@ const getNetlifyNextServer = (NextServer: NextServerType) => {
5454
return
5555
}
5656

57-
// force all standard requests to revalidate so that we always have fresh content
58-
// (we handle caching with ODBs instead of stale-while-revalidate)
57+
// force Next to revalidate all ODB revalidation requests so that we always have fresh content...
58+
// setting this header to the preview mode ID is how Next knows to revalidate
5959
// eslint-disable-next-line no-underscore-dangle
6060
if (headers['x-nf-builder-cache'] === 'revalidate' && !headers.__prerender_bypass) {
61+
console.log(`Revalidating ${url}`)
6162
headers['x-prerender-revalidate'] = this.renderOpts.previewProps.previewModeId
6263
}
6364

0 commit comments

Comments
 (0)