Skip to content

docs: clarify hydration and flash tradeoffs - #101798

Open
aurorascharff wants to merge 28 commits into
docs/lazy-loading-use-casesfrom
codex/docs-hydration-lint
Open

aurorascharff wants to merge 28 commits into
docs/lazy-loading-use-casesfrom
codex/docs-hydration-lint

Conversation

@aurorascharff

@aurorascharff aurorascharff commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Clarify when preventing a flash needs an inline script and when a server-rendered fallback is enough. The date example formats the fallback once on the server and passes that label to the Client Component. The browser can then show a localized date without a hydration mismatch.

Keep the choice in the Preventing Flash guide’s existing “When to use other approaches” section. Link to the SPA guide for browser-only rendering, React for external-store subscriptions and the effect workaround, and #102472 for components first loaded after an interaction. The hydration error page links back to the fallback example. This PR is stacked on #102472.

Also mark the reusable inline-script helper and the ssr: false example as Client Components, and use React’s dateTime prop.

Verification

  • Hosted Chromium verified the retained date example: a server-formatted fallback appears in the HTML and the browser formats the date during hydration without an error. Both remaining code blocks are unchanged from that run.
  • Previously reproduced the inline-script warning on Next.js 16.4.3 with Turbopack and verified the helper preserves initial execution and does not warn when a soft navigation returns to the layout.
  • All 45 JS/TS snippets parse and pass the React purity, refs, and set-state-in-effect checks. All 52 internal links resolve. Targeted MDX ESLint, Prettier, and diff checks pass.

@vercel

vercel Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Vercel Agent finished reviewing your changes and approved this pull request.
0d7b007 • Tue, 17 Nov 2026 08:53:23 GMT

Explanation

Reviewed the full diff and latest fallback explanation against the merge-base documentation policy. The wording preserves the hydration caveat and visible-change tradeoff, and all example code remains unchanged from the previous review; no blocking findings or escalation triggers apply.

Review steps (41.7s)

Preparing the workspace 20.6s
Analyzing the changes 18.3s
Finalizing the review 2.7s

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Tests Passed

Commit: b14a332
View workflow run

@github-actions github-actions Bot added the Documentation Related to Next.js' official documentation. label Nov 14, 2026
@aurorascharff aurorascharff changed the title docs: explain hydration effect lint guidance docs: use a lint-clean hydration example Nov 14, 2026
@aurorascharff aurorascharff changed the title docs: use a lint-clean hydration example docs: clarify browser-only rendering examples Nov 14, 2026
@aurorascharff aurorascharff changed the title docs: clarify browser-only rendering examples docs: clarify hydration mismatch fixes Nov 14, 2026
@aurorascharff aurorascharff changed the title docs: clarify hydration mismatch fixes docs: clarify hydration and flash tradeoffs Nov 14, 2026
@aurorascharff
aurorascharff marked this pull request as ready for review November 15, 2026 19:26
@aurorascharff
aurorascharff requested review from icyJoseph and removed request for icyJoseph November 15, 2026 19:31
@aurorascharff
aurorascharff marked this pull request as draft November 15, 2026 19:31
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

All broken links are now fixed, thank you!

@aurorascharff
aurorascharff force-pushed the codex/docs-hydration-lint branch from 5bd9461 to 06c6f84 Compare November 26, 2026 15:13
@github-actions github-actions Bot added the created-by: Next.js team PRs by the Next.js team. label Nov 26, 2026
@aurorascharff
aurorascharff removed this pull request from stack #102086 November 27, 2026 13:46
@aurorascharff
aurorascharff changed the base branch from canary to docs/lazy-loading-use-cases November 27, 2026 13:46
@aurorascharff
aurorascharff marked this pull request as ready for review November 27, 2026 14:37

This branch has not been deployed

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

Labels

created-by: Next.js team PRs by the Next.js team. Documentation Related to Next.js' official documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant