next.js
9bfaf63e - Fix adapter outputs for not-found routes when used with cache components (#96390)

Commit
78 days ago
Fix adapter outputs for not-found routes when used with cache components (#96390) ## Summary Fix the build output for App Router `not-found` routes that get partially prerendered when cacheComponents is enabled. Previously, Next.js treated any statically generated `/_not-found` route as a complete static 404, even when it contained postponed state. It copied the partial HTML shell to `server/pages/404.html` and omitted the corresponding `/_not-found` prerender from adapter outputs. This change distinguishes fully static not-found routes from partially prerendered ones. Fully static routes retain the existing `404.html` behavior, while PPR routes remain resumable prerender outputs. This allows a `not-found.tsx` that suspends under Cache Components to render its dynamic content when deployed. Closes https://github.com/vercel/next.js/pull/96399 ## Testing Expanded `not-found-non-document-dynamic` coverage to verify that: - dynamic not-found content renders for ordinary missing paths - dynamic not-found content renders when `/_not-found` is selected by a rewrite - a PPR not-found does not emit `server/pages/404.html` - its adapter output includes `PARTIALLY_STATIC` metadata, postponed state, and a resume chain Also verified that fully static App Router not-found routes continue to emit and serve `pages/404.html`. - `__NEXT_CACHE_COMPONENTS=true pnpm test-start-turbo test/e2e/app-dir/not-found-non-document-dynamic/not-found-non-document-dynamic.test.ts` - `pnpm test-start-turbo test/e2e/app-dir/not-found/basic/index.test.ts`
Author
Parents
Loading