mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
Previously, a static segment prefetch that hit a route with an unresolved ISR entry could not be served a fallback shell, so the prefetch cache was left cold until the entry regenerated. This enables prefetch requests to be served the ISR fallback shell immediately, so the prefetch cache can be warmed right away instead of waiting. Because the shell is only a partial response, the client retries the prefetch a bounded number of times so it eventually warms the cache with the full (concrete) response once the server finishes regenerating in the background. Only shells that can actually be upgraded are retried — a route with no generateStaticParams never upgrades, so its shell isn't flagged and the client doesn't waste retries on it. The new serving behavior is gated behind the experimental `appShells` flag, so existing behavior is unchanged when it's off. <!-- NEXT_JS_LLM_PR -->
26 lines
738 B
TypeScript
26 lines
738 B
TypeScript
import { Suspense } from 'react'
|
|
|
|
type Params = { id: string }
|
|
|
|
// Fully prerendered at build time: the concrete params are known via
|
|
// generateStaticParams, so a prefetch receives the concrete version and is
|
|
// never marked as a fallback.
|
|
export async function generateStaticParams() {
|
|
return [{ id: '1' }]
|
|
}
|
|
|
|
export default function Page({ params }: { params: Promise<Params> }) {
|
|
return (
|
|
<main>
|
|
<Suspense fallback={<p id="static-shell">App shell for static posts</p>}>
|
|
<ParamsDependent params={params} />
|
|
</Suspense>
|
|
</main>
|
|
)
|
|
}
|
|
|
|
async function ParamsDependent({ params }: { params: Promise<Params> }) {
|
|
const { id } = await params
|
|
return <p id="static-post-content">{`Static post ${id}`}</p>
|
|
}
|