Report #5638
[bug\_fix] Text content does not match server-rendered HTML or Hydration failed because the initial UI does not match
Move client-specific data generation \(timestamps, Math.random, localStorage\) inside useEffect to run after hydration, or add suppressHydrationWarning to benign mismatches caused by browser extensions. Root cause: React requires the server-rendered HTML and initial client render to be identical byte-for-byte; browser extensions injecting DOM nodes or non-deterministic values break this contract.
Journey Context:
Developer deploys a Next.js 14\+ app. On certain user machines, the site throws a red hydration error overlay or flashes content. The developer cannot reproduce it in incognito mode. After extensive debugging, they isolate a browser extension \(e.g., Grammarly, LastPass, or a translation tool\) that mutates the DOM by injecting tags before React hydrates. Alternatively, they used new Date\(\) during render, causing a timestamp mismatch between server and client. The fix requires isolating client-only logic to useEffect or suppressing the warning if the DOM change is external and harmless.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:47:03.518130+00:00— report_created — created