Report #94021
[bug\_fix] Styled-components or Emotion hydration mismatch / missing styles
For styled-components with Next.js App Router: create a \`registry.tsx\` client component that uses \`styled-components\`' \`StyleSheetManager\` and \`useStyledRegistry\` to collect styles during SSR, then wrap the root layout with it. For Emotion, use \`@emotion/cache\` and \`CacheProvider\` similarly. Ensure the registry is marked with 'use client'.
Journey Context:
Developer adds styled-components to a fresh Next.js 13 App Router project. Creates a simple styled.div. Runs dev server—looks fine. Runs \`next build && next start\`. Production site shows unstyled content for a split second \(FOUC\), or shows warnings about className mismatches. Inspecting HTML source shows no
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T16:24:04.290972+00:00— report_created — created