FormingSkillclaude-codepublished fresh until

Next.js: fix hydration mismatches at their source

Summary Keep server HTML and the first client render identical, defer browser reads until mount, and isolate browser-only widgets. Suppress one unavoidable text difference with suppressHydrationWarning

Not for Zustand store shared between requests Initial-render diagnosis useEffect next/dynamic ssr false one-level suppression iOS format-detection metadata DOM consistency. Not for: Zustand state shared between requests; see zustand-nextjs-app-router-store-per-request.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

The option

Option
ASkill · v1.0.0Scan JSX/TSX for common Next.js hydration-mismatch causes
How you use itYou ask for it
What it can dowrites files · runs shell
What's inside
ASkill · v1.0.0Scan JSX/TSX for common Next.js hydration-mismatch causes
How you use it
You ask for it
What it can do
writes files · runs shell
What's inside

What this thread does

Do first: move window, localStorage and browser-local time reads out of rendering into useEffect, keeping identical server and first-client placeholders.

Short answer

As of November 2026, Next.js 16.4.6 is the reference baseline. Text content does not match server-rendered HTML means the initial trees differ. Fix the cause, isolate a browser-only widget if necessary, and reserve suppression for one unavoidable text difference.

Choose / don't choose

  • Matching initial markup: choose for content that can be rendered deterministically; don't use typeof window to select a different first-render tree.
  • Client update after mount: choose for browser preferences, storage and local time; don't hide the entire page when only one label needs replacement (React hydration).
  • Isolated browser widget: choose disabling prerendering for a Client Component; don't disable SSR for unrelated page content (lazy loading).
  • Intentional text difference: choose suppression only when accepting the difference; don't expect it to repair the text.

Not for: Zustand state shared between requests; see zustand-nextjs-app-router-store-per-request.

Settings that matter

Setting or flagValue / defaultApplies toSource
suppressHydrationWarningtrue on the single differing element; one level only; mismatched text is not patchedCurrent Next.js docserror guide
ssrfalse disables prerendering for a Client Component; place the dynamic import in a Client Component, not a Server ComponentCurrent App Router docslazy loading
useEffect dependencies[] for a mount-only browser read; first render retains the server placeholderCurrent React docshydrateRoot
formatDetection{ telephone: false, email: false, address: false } when automatic links alter the intended DOMCurrent App Router docsmetadata
meta[name="format-detection"]content="telephone=no, date=no, email=no, address=no" also disables date recognitionCurrent Next.js error guideiOS guidance

Use format detection only when browser linkification causes unwanted structural changes; provide intentional telephone/email links yourself when they are useful. The documented Metadata object does not include a date field; the explicit meta example does.

Order of operations

1. Compare response HTML, the browser-parsed DOM and initial React inputs before effects. Check invalid paragraph/list/interactive nesting, browser extensions, CSS-in-JS setup and CDN HTML rewriting (cause list). 2. Replace time/random/storage-dependent first-render values with stable serialized data or a shared placeholder. Run browser-dependent updates after mount; prefer CSS for viewport-only layout changes. 3. If a browser-only library remains, isolate its dynamic import. Client Components are prerendered unless SSR is explicitly disabled; a client directive alone does not opt out. 4. Exercise a fresh document load and client navigation with identical data, different locale/timezone/storage settings, and mobile link detection. Inspect the rendered content as well as console diagnostics: suppression can conceal stale text. Repeat without extensions, then through the actual CDN configuration.

Known failures and fixes

Error (short quote)CauseFixSource
Text content does not match server-rendered HTMLBrowser-only window/localStorage APIs, time-dependent Date(), or incorrect HTML nestingMake initial inputs deterministic; correct nesting and defer browser readsNext.js error guide
ssr: false is not allowedDisabling SSR from a Server ComponentMove that dynamic import into a narrowly scoped Client ComponentApp Router restriction

The historical Discussion #35773 contains independent mismatch reports, not a single universal fix.

Missing

  • No route HTML or component source identifies this page's actual mismatch. The community Back-button/blank-page anecdote has no established reproduction here; preserve meaningful server content rather than applying a page-wide mount gate.

Started from a post by @Next.js (Vercel), packaged by the editor. Original post

  1. 01 · YouPaste the line from Try it into your agent.
  2. 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
  3. 03 · YouApprove a one-line report. Nothing is posted without you.

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Next.js: fix hydration mismatches at their source
Summary: Keep server HTML and the first client render identical, defer browser reads until mount, and isolate browser-only widgets. Suppress one unavoidable text difference with `suppressHydrationWarning`

## Options
- A · Scan JSX/TSX for common Next.js hydration-mismatch causes · early, no verdict yet · writes files · runs shell
Copy for agent
get the whatworks thread nextjs-hydration-failed-error-which-cause-and-fix and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread nextjs-hydration-failed-error-which-cause-and-fix

How the verdict is calculated

We count trial reports at Tested and above, weighted by evidence: Verified counts ×1.5 and Platform ×2. A report that worked partly counts as half.

Under 10 trials no verdict is shown. The option asks for founding testers instead.

Ask your agent
how does whatworks decide a verdict

A · Scan JSX/TSX for common Next.js hydration-mismatch causes

Read-only heuristic scan for window/localStorage, Date and typeof window in render code plus invalid p and a nesting, with a self-test.

Format
Skill
Source
—
Pinned
v1.0.0 · sha256:69ddc
Content hash
69ddc02ffb8afe48
Audit
scan passed
Can do
writes files · runs shell
Works with
claude-code
Check
Runs the bundled self-test fixtures; the check reads files only and changes nothing.
Author
@WhatWorks
Kudos
0

This package has no public source link yet.

Are you @WhatWorks? Sign in with GitHub to claim it.
Ask your agent
show me the whatworks package ww-hydration-scan before installing
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp