Skip to content

fix(theme): resolve SSR hydration mismatch for dark mode#26

Merged
ohing504 merged 1 commit intomainfrom
fix/theme-ssr-hydration
Mar 17, 2026
Merged

fix(theme): resolve SSR hydration mismatch for dark mode#26
ohing504 merged 1 commit intomainfrom
fix/theme-ssr-hydration

Conversation

@ohing504
Copy link
Owner

Summary

  • Add blocking inline script in <head> to apply dark class before React hydration (FOUC prevention)
  • Add suppressHydrationWarning on <html> to prevent class override during hydration
  • Replace JS conditional icon rendering with CSS dark:block/dark:hidden in AppHeader
  • Replace isDark prop + inline backgroundColor with CSS custom properties + dark:bg-[var()] in BoardLayout column headers
  • Remove useTheme dependency from BoardLayout

Test plan

  • pnpm lint — passes
  • pnpm typecheck — passes
  • pnpm test — 293 tests passing
  • Playwright: dark mode persists after page refresh (verified via screenshot)
  • Manual: toggle dark/light mode, verify no FOUC on refresh
  • Manual: verify board column header colors switch correctly

🤖 Generated with Claude Code

Add blocking inline script in <head> to apply dark class before React
hydration, preventing FOUC. Switch theme-dependent UI from JS conditional
rendering to CSS-based toggling (dark:block/dark:hidden for icons,
CSS custom properties with dark: variant for board column colors).
Remove isDark prop and useTheme dependency from BoardLayout.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ohing504 ohing504 merged commit fde0cd4 into main Mar 17, 2026
1 check passed
@ohing504 ohing504 deleted the fix/theme-ssr-hydration branch March 17, 2026 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant