Skip to content

docs: clarify not-found with dynamic root layouts - #96978

Draft
DavidIlie wants to merge 1 commit into
canaryfrom
codex/root-not-found-dynamic-layout-docs
Draft

docs: clarify not-found with dynamic root layouts#96978
DavidIlie wants to merge 1 commit into
canaryfrom
codex/root-not-found-dynamic-layout-docs

Conversation

@DavidIlie

Copy link
Copy Markdown
Contributor

What?

Clarifies how not-found UI works when the only application root layout is nested under a dynamic segment such as app/[lang]/layout.js.

The reference now compares two supported patterns:

  • global-not-found.js handles routing-level misses with a hard 404, but owns the full document and does not inherit the dynamic layout.
  • A nested app/[lang]/not-found.js plus [...rest] page preserves the localized layout and follows the normal streamed notFound() status behavior.

The localized recipe explicitly tells readers to remove the root app/not-found.js boundary before moving it below [lang].

Why?

A globally unmatched URL has no resolved value for a dynamic root parameter, so Next.js cannot compose that response with app/[lang]/layout.js. The existing docs mention global-not-found.js for this topology but do not show the stable catch-all alternative or explain its layout and HTTP-status trade-offs.

This is intentionally docs-only. The minimal topology builds successfully on current canary with both webpack and Turbopack, including Cache Components, so there is no reproducible loader failure to patch.

Related to #59180 and discussion #50034.

How?

Adds a focused comparison table, TypeScript and JavaScript catch-all examples, and a link to the streamed status-code guidance.

Verification

  • pnpm --filter=next build
  • npx eslint --config eslint.config.mjs docs/01-app/03-api-reference/03-file-conventions/not-found.mdx
  • Reproduced the dynamic-root topology with webpack, Turbopack, and cacheComponents: true

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Tests Passed

Commit: cd277ca

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Stats skipped

Commit: cd277ca
View workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant