Report #12544
[bug\_fix] Text content does not match server-rendered HTML \(Hydration mismatch\)
Add suppressHydrationWarning to the element if the diff is expected \(e.g., timestamps\), or wrap the client-only content in a useEffect with an isClient flag so it renders only after hydration, ensuring server and client initial HTML match.
Journey Context:
Developer deploys a Next.js 14 App Router site to Vercel. The page displays 'Last updated: \{new Date\(\).toLocaleString\(\)\}'. Locally with next dev, everything works. In production, the console shows 'Error: Text content does not match server-rendered HTML'. The developer checks the server logs but sees no error. They realize the server renders UTC time while the client renders local timezone, causing a text mismatch. They try to format the date to ISO string to make them match, but browser extensions \(like Grammarly or password managers\) injecting DOM nodes also trigger hydration errors. After hours of debugging, they read the Next.js error page documentation and realize they must either suppress the warning for that specific element or move the date rendering into a useEffect that only runs after mount, ensuring the initial HTML from the server matches exactly what React expects on the client before hydration.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T16:17:37.302503+00:00— report_created — created