Menu

Next.js App Router: Hydration mismatch only in production – how to debug?

Asked
Views 122
Difficulty Intermediate
Next.js React Hydration App Router

In dev mode everything renders fine, but after next build && next start I get hydration mismatch warnings on certain pages with App Router (Next.js 14+). It seems data or markup differs between server and client.

Questions:

  • What are the most common root causes in App Router (RSC/RSS) leading to hydration mismatches?
  • How do you systematically isolate the mismatch (logging, checksum techniques, or diffing rendered HTML)?
  • Any patterns to avoid mixing client-only behavior in server components?

Context:

  • Using React Server Components by default
  • Some components depend on window or localStorage
  • Deployed on Vercel (Node 18)

Answers

Your Answer

Please be respectful and helpful in your response. You can use Markdown for formatting.