Unverified Commit f2d2dde5 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Fix revalidate during dev (#41772)

Fix typo `revalidate` -> `fetchRevalidate`
parent 67c802ac
......@@ -10,7 +10,7 @@ export function staticGenerationBailout(reason: string) {
if (staticGenerationStore?.isStaticGeneration) {
// TODO: honor the dynamic: 'force-static'
if (staticGenerationStore) {
staticGenerationStore.revalidate = 0
staticGenerationStore.fetchRevalidate = 0
}
throw new DynamicServerError(reason)
}
......
......@@ -238,13 +238,13 @@ function patchFetch(ComponentMod: any) {
) {
staticGenerationStore.fetchRevalidate = next.revalidate
// TODO: ensure this error isn't logged to the user
// seems it's slipping through currently
throw new DynamicServerError(
`revalidate: ${next.revalidate} fetch ${input}${
pathname ? ` ${pathname}` : ''
}`
)
if (next.revalidate === 0) {
throw new DynamicServerError(
`revalidate: ${next.revalidate} fetch ${input}${
pathname ? ` ${pathname}` : ''
}`
)
}
}
if (hasNextConfig) delete init.next
}
......@@ -735,7 +735,9 @@ export async function renderToHTMLOrFlight(
supportsDynamicHTML,
} = renderOpts
patchFetch(ComponentMod)
if (process.env.NODE_ENV === 'production') {
patchFetch(ComponentMod)
}
const generateStaticHTML = supportsDynamicHTML !== true
const staticGenerationAsyncStorage = ComponentMod.staticGenerationAsyncStorage
......@@ -1619,9 +1621,9 @@ export async function renderToHTMLOrFlight(
;(renderOpts as any).pageData = filteredFlightData
;(renderOpts as any).revalidate =
typeof staticGenerationStore?.revalidate === 'undefined'
typeof staticGenerationStore?.fetchRevalidate === 'undefined'
? defaultRevalidate
: staticGenerationStore?.revalidate
: staticGenerationStore?.fetchRevalidate
return new RenderResult(htmlResult)
}
......
......@@ -2,7 +2,10 @@ import Link from 'next/link'
export const dynamicParams = false
export default function Page({ params }) {
export default async function Page({ params }) {
await fetch('https://example.vercel.sh', {
next: { revalidate: 10 },
})
return (
<>
<p id="page">/blog/[author]</p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment