next.js
834c41ef - Respect `generateStaticParams` in instant navigation shell (#91316)

Commit
6 days ago
Respect `generateStaticParams` in instant navigation shell (#91316) When the instant navigation testing cookie is set, the debug static shell path previously called `getFallbackRouteParams()` which treats all dynamic segments as fallback params regardless of `generateStaticParams`. This caused two issues: - Root params (via `next/root-params`) errored with a `NEXT_STATIC_GEN_BAILOUT` 500 response because the root layout's param access returned a hanging promise, which was treated as uncached data accessed outside of `<Suspense>`. - Params defined in `generateStaticParams` were incorrectly excluded from the instant shell, shown behind Suspense fallbacks instead of resolving. The fix uses `prerenderInfo?.fallbackRouteParams` from the prerender manifest instead, which correctly distinguishes between statically known params (defined in `generateStaticParams`) and unknown params. For prerendered URLs, the outer guard (`!isPrerendered`) prevents the fallback path from being entered, so no fallback params are set and all params resolve normally. To make this work in dev mode, the dev server now populates `fallbackRouteParams` in the prerender manifest's dynamic route entries, which were previously left as `undefined`. Additionally, the `fallbackParams` request metadata is now overridden when rendering a debug static shell. Without this override, the staged rendering would use the smallest set of fallback params across all prerendered routes (set by `base-server.ts` for dev validation), which may omit fallback params for the current URL when a different value for the same param is defined in `generateStaticParams`. The override ensures the route-specific fallback params are used instead.
Author
Parents
Loading