fix(core): resolve server-client hydration mismatch in theme provider layout #649
Conversation
|
Hi @Aditya948351, Issue #629 is complete and the branch is clean. Please review and merge! |
|
@shivani11jadhav I will Close your Further PRs directly without Reviewing if issue is not linked Properly! |
|
@shivani11jadhav I have resolved the single file conflict myself for now and merging this PR now! |
4648d70
into
devpathindcommunity-india:master
|
Thanks a lot for resolving the conflict and merging it,@Aditya948351 ! Really glad the hydration fix and TypeScript changes worked out well. Also, sorry again for the issue tracking mix-up earlier—I will definitely double-check and make sure the exact issue is linked properly from the start in all my future PRs. Appreciate the guidance! |
|
Hi,@Aditya948351 my PR has been merged successfully, but it is not showing in the GSSoC tracker/dashboard yet. Could you please verify if all the required GSSoC labels have been applied? |
Yeah it takes time to update the production! |
🔍 Bug Fix Overview for Issue #629
This PR resolves the structural Next.js App Router hydration mismatch error triggered when the client reads theme configurations (dark/light states) from
localStorageduring the initial HTML mounting cycle. It ensures consistent server-rendered and client-hydrated DOM trees.🛠️ Key Technical Implementations
Mounted State Lifecycle (
theme-provider.tsx):mountedstate tracker (useState(false)) inside the global Theme Provider.useEffecthook to delay client-side theme execution until hydration completes safely on the browser client.style={{ visibility: 'hidden' }}) during the server-render pass to eliminate Flash of Unstyled Content (FOUC) and tree discrepancies.Hydration Attribute Suppressions (
layout.tsx):suppressHydrationWarningflag strictly to the top-level<html>and<body>tags.🧪 Verification Metrics
npm run buildcompiled 100% successfully across all static routes with zero hydration drop warnings.