mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +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.
32 lines
669 B
JavaScript
32 lines
669 B
JavaScript
import { fetchRetry } from '../../../lib/fetch-retry'
|
|
|
|
export const revalidate = 3
|
|
|
|
export async function generateStaticParams() {
|
|
return [{ slug: 'one' }]
|
|
}
|
|
|
|
export default async function page({ params }) {
|
|
const { slug } = params
|
|
let data
|
|
|
|
if (process.env.NEXT_PHASE !== 'phase-production-build') {
|
|
data = await fetchRetry(
|
|
'https://next-data-api-endpoint.vercel.app/api/random',
|
|
{
|
|
headers: {
|
|
Authorization: 'Bearer my-token',
|
|
},
|
|
}
|
|
).then((res) => res.text())
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<p id="page">/gen-params-dynamic/[slug]</p>
|
|
<p id="slug">{slug}</p>
|
|
<p id="data">{data}</p>
|
|
</>
|
|
)
|
|
}
|