Skip to content

fix: hydration mismatch + offline hook rewrite#27

Merged
sparshsam merged 1 commit into
mainfrom
feat/copy-website-content
Jun 28, 2026
Merged

fix: hydration mismatch + offline hook rewrite#27
sparshsam merged 1 commit into
mainfrom
feat/copy-website-content

Conversation

@sparshsam

Copy link
Copy Markdown
Owner

Summary

Fixes two issues discovered during local testing:

  1. Hydration mismatch — The inline theme script sets data-theme on <html> during HTML parsing, but the server-rendered HTML doesn't have it. Added suppressHydrationWarning to <html> (standard Next.js pattern for theme toggling).

  2. Offline notice false positive — Rewrote useOnlineStatus() with useSyncExternalStore to eliminate flash of offline notice and align with React 19 best practices.

Checklist

  • No secrets or credentials
  • Lint passes (0 errors)
  • Typecheck passes
  • Build passes

- Add suppressHydrationWarning to <html> element to prevent React
  hydration mismatch from inline theme script setting data-theme
- Rewrite useOnlineStatus() with useSyncExternalStore (React 19 pattern)
  to eliminate flash of offline notice and avoid setState-in-effect lint
- Hardened OfflineNotice with aria-live and role=alert
@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openproof Building Building Preview, Comment Jun 28, 2026 5:15am

@sparshsam sparshsam merged commit 6552c44 into main Jun 28, 2026
2 of 3 checks passed
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