@@ -588,13 +588,17 @@ export async function generateStaticParams() {
...
@@ -588,13 +588,17 @@ export async function generateStaticParams() {
}
}
```
```
Pathsyoudon't return are still served. Next.js serves the App Shell instantly, then upgrades it in the background once the params are known. See [ISR with Cache Components](/docs/app/guides/incremental-static-regeneration-cache-components) for the full prerender-a-subset workflow.
Pathsyoudon't return are still served. Next.js prerenders a static shell for the unknown params and streams the rest at request time. See [ISR with Cache Components](/docs/app/guides/incremental-static-regeneration-cache-components) for the full prerender-a-subset workflow.
### `dynamicParams` no longer blocks the first visit
### `dynamicParams` is not supported
**`dynamicParams: true` (the default) now serves an App Shell instead of blocking.** Previously, visiting a param not returned by `generateStaticParams` blocked the response while the page rendered. With Cache Components, Next.js serves the App Shell instantly, then upgrades it in the background with the now-known params. `dynamicParams: false` is unchanged: unspecified paths still 404.
**Delete the export.** With Cache Components enabled, `export const dynamicParams` fails the build with `Route segment config "dynamicParams" is not compatible with nextConfig.cacheComponents`.
To produce the App Shell, pass the `params` promise into a [`<Suspense>`](/docs/app/api-reference/file-conventions/loading) boundary instead of awaiting it at the top of the component, so unknown params can still prerender.
Params not returned by `generateStaticParams` are rendered on request. If you used `dynamicParams: false` to reject them, call [`notFound()`](/docs/app/api-reference/functions/not-found) in the page when the param doesn'tresolvetorealdata.
// Before - awaiting params at the top blocks the shell
// Before - awaiting params at the top blocks the shell
...
@@ -652,7 +656,7 @@ async function Post({ params }) {
...
@@ -652,7 +656,7 @@ async function Post({ params }) {
}
}
```
```
The same applies to client hooks that read the route. When the route'spathnameisfullyknown,theyresolveduringprerenderingandneednoboundary.Whenitdependsondynamicparamsnotyetknown,theysuspend,whereverthecomponentsits.Anavorbreadcrumbinasharedlayout,forinstance,suspendswhileNext.jsgeneratestheAppShellforanyroutebelowitthathasdynamicparams.Wrapthecomponentthatreadsthehookin`<Suspense>`(pushthereaddowntothesmallestleafsothereststaysprerendered),orthebuildfails:
Thesameappliestoclienthooksthatreadtheroute.Whentheroute's pathname is fully known, they resolve during prerendering and need no boundary. When it depends on dynamic params not yet known, they suspend, wherever the component sits. A nav or breadcrumb in a shared layout, for instance, suspends while Next.js generates the static shell for any route below it that has dynamic params. Wrap the component that reads the hook in `<Suspense>` (push the read down to the smallest leaf so the rest stays prerendered), or the build fails: