Skip to content

fix(core): resolve server-client hydration mismatch in theme provider layout #629

@shivani11jadhav

Description

@shivani11jadhav

🔍 Bug Fix Details

Objective:
Fix the structural Next.js App Router hydration mismatch error triggered when the client reads theme states (dark/light) from localStorage during the initial HTML mounting cycle.

Technical Strategy:

  • Mounted State Lifecycle: Introduce a robust mounted state hook inside the Theme Provider context to delay client-side context injection until useEffect executes safely on the browser client.
  • Hydration Flag Suppressions: Apply standard Next.js suppressHydrationWarning flags strictly on target top-level document layouts (<html>/<body>) to allow dynamic attribute evaluation without runtime script halts.
  • Clean Execution Matrix: Ensure the platform layout initializes seamlessly across all dynamic and static paths with zero terminal hydration drops.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions