Skip to content

docs: clarify /_not-found failures and <html> attribute reads under Cache Components#95163

Merged
aurorascharff merged 10 commits into
canaryfrom
aurorascharff/docs-not-found-html-attribute-gotcha
Jun 25, 2026
Merged

docs: clarify /_not-found failures and <html> attribute reads under Cache Components#95163
aurorascharff merged 10 commits into
canaryfrom
aurorascharff/docs-not-found-html-attribute-gotcha

Conversation

@aurorascharff

Copy link
Copy Markdown
Contributor

Summary

When the root layout reads request data (cookies(), headers()) under Cache Components, the validation error often surfaces on /_not-found — a real prerendered route that inherits the root layout, even though the user has no not-found.tsx file. This is consistently confusing (#67532), so:

  • errors/blocking-prerender-runtime.mdx and errors/blocking-prerender-dynamic.mdx: added a gotcha bullet pointing the fix at the root layout when the failing route is /_not-found.
  • docs/01-app/02-guides/migrating-to-cache-components.mdx: added a Good to know callout in the cookies, headers, and searchParams section linking to the existing Themes recipe for the <html data-theme> case, since attributes on the root element can not be wrapped in <Suspense>.

Verification

  • npx alex clean on all three files.
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Stats skipped

Commit: defc3e2
View workflow run

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Tests Passed

Commit: defc3e2

@aurorascharff aurorascharff marked this pull request as ready for review June 25, 2026 13:07
Copilot AI review requested due to automatic review settings June 25, 2026 13:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Cache Components documentation by clarifying two common sources of confusion: why validation failures can surface on the synthetic /_not-found route, and why reading request-bound values to set <html> attributes can’t be “fixed” with <Suspense> in a child component.

Changes:

  • Update the “blocking prerender” error docs to explain why /_not-found can be the reported failing route and how to trace the real source (root layout).
  • Expand the troubleshooting guidance about differences between next dev overlays vs abbreviated next build stacks, and point to --debug-prerender / --debug-build-paths.
  • Add guidance and an example for avoiding theme flash when the theme is stored in cookies, without making the root layout request-bound.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
errors/blocking-prerender-runtime.mdx Adds /_not-found gotcha and refines guidance on debugging blocking routes under Cache Components.
errors/blocking-prerender-dynamic.mdx Mirrors the debugging guidance and adds the /_not-found clarification for uncached-data failures.
docs/01-app/02-guides/preventing-flash-before-hydration.mdx Adds a cookie-based theme pattern using a pre-paint inline script to keep the shell static.
docs/01-app/02-guides/migrating-to-cache-components.mdx Adds a “Good to know” callout explaining <html> attribute constraints and links to the recommended pattern.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/01-app/02-guides/migrating-to-cache-components.mdx Outdated
Comment thread docs/01-app/02-guides/preventing-flash-before-hydration.mdx Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@aurorascharff aurorascharff requested a review from icyJoseph June 25, 2026 13:14
@aurorascharff aurorascharff merged commit d4b2340 into canary Jun 25, 2026
67 checks passed
@aurorascharff aurorascharff deleted the aurorascharff/docs-not-found-html-attribute-gotcha branch June 25, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants