Report #66250
[bug\_fix] Text content does not match server-rendered HTML \(Hydration mismatch\)
Move browser-only logic \(new Date\(\), window, localStorage\) inside a useEffect with an isClient guard, or use a dynamic import with ssr: false for the component. For dates, pass ISO strings from the Server Component and format them in useEffect, or use suppressHydrationWarning only for non-critical content.
Journey Context:
Developer deploys a dashboard to Vercel. On hard refresh, the console shows "Text content does not match server-rendered HTML." The diff shows the server sent "2024-01-15T00:00:00.000Z" while the client expects "1/14/2024, 6:00 PM" due to timezone conversion. Developer initially tries suppressHydrationWarning=\{true\} on the span, which silences the error but causes a visible flash of incorrect dates. They then try conditionally rendering \{isClient ? formattedDate : null\}, but isClient is set to true in useEffect, causing a layout shift. After reading the React hydration docs, they realize the server and client must emit identical HTML on first render. They refactor to pass the raw ISO date from the Server Component as a prop, then format it inside useEffect only after hydration is complete, or use a library like date-fns-tz with a stable timezone to ensure server/client parity.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:40:39.252472+00:00— report_created — created