8000 chore: log warning about isr (#565) · opennextjs/opennextjs-netlify@8e266aa · GitHub
[go: up one dir, main page]

Skip to content

Commit 8e266aa

Browse files
chore: log warning about isr (#565)
1 parent 386029e commit 8e266aa

File tree

1 file changed

+15
-0
lines changed
  • src/lib/pages/getStaticPropsWithRevalidate

1 file changed

+15
-0
lines changed

src/lib/pages/getStaticPropsWithRevalidate/pages.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const { yellowBright } = require('chalk')
2+
13
const asyncForEach = require('../../helpers/asyncForEach')
24
const getPrerenderManifest = require('../../helpers/getPrerenderManifest')
35
const isRouteWithFallback = require('../../helpers/isRouteWithFallback')
@@ -9,10 +11,14 @@ const getPages = async () => {
911
// Collect pages
1012
const pages = []
1113

14+
let usesRevalidateAtLeastOnce = false
15+
1216
await asyncForEach(Object.entries(routes), async ([route, { dataRoute, srcRoute, initialRevalidateSeconds }]) => {
1317
// Skip pages without revalidate, these are handled by getStaticProps/pages
1418
if (!initialRevalidateSeconds) return
1519

20+
usesRevalidateAtLeastOnce = true
21+
1622
// Skip pages with fallback, these are handled by
1723
// getStaticPropsWithFallback/pages
1824
if (await isRouteWithFallback(srcRoute)) return
@@ -24,6 +30,15 @@ const getPages = async () => {
2430
dataRoute,
2531
})
2632
})
33+
34+
if (usesRevalidateAtLeastOnce) {
35+
console.log(
36+
yellowBright(
37+
`Warning: It looks like you're using the 'revalidate' flag in one of your Next.js pages. Please read our docs about ISR on Netlify: https://ntl.fyi/next-isr-info`,
38+
),
39+
)
40+
}
41+
2742
return pages
2843
}
2944

0 commit comments

Comments
 (0)
0