Files
Wyatt JohnsonandGitHub eab1fe8397 Enable PPR for dynamic = "force-dynamic" (#58779)
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.
2023-12-06 01:10:00 +00:00

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>
</>
)
}