mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
This makes some critical modifications to the app render pipeline when PPR has been enabled for pages with segments defining: ```js export const dynamic = "force-dynamic" ``` Importantly, it no longer modifies the revalidation time to zero for those pages, and now falls back to the provided default revalidation time. When static render occurs, if the page being rendered has a segment config defining `dynamic === "force-dynamic"`, then it will postpone at the root of the component tree. This ensures that no render code is executed for the page, as the entirety of the tree will have postponed. This fixes the bug where the flight prefetch wasn't generated correctly as well.
37 lines
795 B
JavaScript
37 lines
795 B
JavaScript
import { fetchRetry } from '../../../lib/fetch-retry'
|
|
|
|
export const revalidate = 0
|
|
|
|
export default async function Page() {
|
|
const data = await fetchRetry(
|
|
'https://next-data-api-endpoint.vercel.app/api/random?status=404',
|
|
{
|
|
next: {
|
|
revalidate: 3,
|
|
},
|
|
}
|
|
).then(async (res) => {
|
|
return {
|
|
status: res.status,
|
|
text: await res.text(),
|
|
}
|
|
})
|
|
|
|
const data2 = await fetchRetry(
|
|
'https://next-data-api-endpoint.vercel.app/api/random?status=204'
|
|
).then(async (res) => {
|
|
return {
|
|
status: res.status,
|
|
text: await res.text(),
|
|
}
|
|
})
|
|
|
|
return (
|
|
<>
|
|
<p id="page">/variable-revalidate/status-code</p>
|
|
<p id="page-data">{JSON.stringify(data)}</p>
|
|
<p id="page-data2">{JSON.stringify(data2)}</p>
|
|
</>
|
|
)
|
|
}
|