next.js
f765823e - prefetchInlining: fix build crash on notFound() pages (#92806)

Commit
96 days ago
prefetchInlining: fix build crash on notFound() pages (#92806) When traversing the route tree in collectPrefetchHints, we use keys from the FlightRouterState to look up corresponding entries in the seed data object. Usually these two structures agree, but there are subtle cases like notFound() where the router state contains keys that don't exist in the seed data. TypeScript doesn't catch this because the `in` operator narrows the key to `string`, which is assignable to the seed data object's index signature — but the lookup returns `undefined` rather than `null`. Eventually the plan is to converge these into a single data structure so this kind of mismatch can't happen structurally. For now, coalesce undefined to null with `?? null`, matching the pattern already used in ppr-navigations.ts and segment-cache/cache.ts on the client. ## Test plan - Added regression test: page with `notFound()` + `generateStaticParams` under `prefetchInlining` - Verified the build crashes without the fix and passes with it - All existing prefetch-inlining tests continue to pass <!-- NEXT_JS_LLM_PR -->
Author
Parents
Loading