AddThisFeature

Hydration Mismatch Guard

Find and fix the places where the server markup and the first client render disagree.

involved Developer Experience

What it adds

A detection and prevention pass over every value that can differ between the server render and the browser's first render.

What your agent is told to do

5
  1. 1

    Walk the known sources of divergence and fix them at the source: timestamps formatted in the server's zone, generated identifiers, locale and currency chosen from a header on one side and a browser setting on the other, and a theme read from storage after the markup was already sent.

  2. 2

    Format dates, numbers, and currency from an explicit locale and zone resolved once and passed through the render, rather than letting each side pick up its own environment default.

  3. 3

    Give anything genuinely browser-only — a chart sized to the viewport, a value read from storage, a random promotion slot — a reserved space in the server output that matches the final dimensions, so the swap changes content and not layout.

  4. 4

    Make a mismatch loud in development and reportable in production: capture which component and which value diverged, so the report names a cause rather than saying the markup did not match.

  5. 5

    Do not silence the warning globally or paper over a component by forcing it to render only on the client. A blanket suppression hides the next mismatch, which will be a wrong price or a stale permission rather than a stray timestamp.

Edge cases it handles

7
  • Dates, generated identifiers, locale, and theme are the four that cause most mismatches, and each needs a stable answer decided once per request rather than independently on each side of the boundary.
  • Client-only content must occupy the space it will eventually fill. Rendering nothing on the server and something afterwards shifts everything below it, which is both a visible jump and a layout-stability penalty.
  • A mismatch report that says only that the markup differed is not actionable. Capture the component, the offending attribute or text, and both values, or nobody will find it in a large page.
  • Suppression must stay narrow and deliberate, attached to the specific element whose difference is expected — a relative timestamp, for instance — and never applied at the root.
  • Browser extensions inject attributes and elements into the markup and will trigger mismatches nobody wrote, so reporting needs to tolerate them without drowning real findings.
  • Content that depends on the signed-in user must not be cached from a render made for someone else; a mismatch here is a data leak, not a cosmetic bug.
  • Feature flags and experiment assignments must be resolved once per request and passed to the client, or the two sides will render different variants of the same page.

Definition of done

8
  • Dates, identifiers, locale, currency, and theme resolve identically on both sides of the render boundary.
  • Client-only regions reserve their final dimensions in the server output and cause no layout shift.
  • A mismatch in development names the component and both differing values.
  • Mismatches in production are reported with enough context to locate the source.
  • Suppression appears only on specific elements with a documented reason, never at the root.
  • The app renders through its main flows with no hydration warnings from its own code.
  • The feature matches the existing design system.
  • No existing functionality is broken.

Related features

How it works

  1. 1

    Copy the link

    Grab the Markdown instruction URL for this feature.

  2. 2

    Give it to your AI

    Paste it into Claude Code, Cursor, v0, Lovable — whatever you build with.

  3. 3

    It inspects, then implements

    Your agent reads your existing app first, then adds the feature to fit it.

Works with your stack

These instructions are written to adapt. They tell the agent to detect your framework, match your existing design system, and reuse what you already have — rather than assuming a particular stack.

Need it tighter than that? Customize the feature and tell it exactly what you're running.