Skip to content

feat: implement cookie-based light/dark mode theming with system preference support#143

Merged
RUKAYAT-CODER merged 2 commits into
rinafcode:mainfrom
T-kesh:feat/dark-mode-flicker
Apr 22, 2026
Merged

feat: implement cookie-based light/dark mode theming with system preference support#143
RUKAYAT-CODER merged 2 commits into
rinafcode:mainfrom
T-kesh:feat/dark-mode-flicker

Conversation

@T-kesh
Copy link
Copy Markdown
Contributor

@T-kesh T-kesh commented Apr 22, 2026

This PR resolves a widespread UX issue where users experienced a jarring Flash of Unstyled Content (FOUC) upon initial load due to delayed client-side theme hydration. To address this natively within the Server-Side Rendering (SSR) pipeline, the next-themes dependency was completely stripped and replaced with a custom, cookie-based ThemeProvider Context. By migrating user theme preferences (light, dark, or system) directly into cookies, layout.tsx now evaluates cookies().get('theme') on the server and safely injects a render-blocking, inline script tag into the of the DOM. This intercept completely eliminates all layout flashing while gracefully defaulting to the OS's prefers-color-scheme if no cookie is detected.
closes #139
Thank you

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 22, 2026

@T-kesh Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER RUKAYAT-CODER merged commit f861330 into rinafcode:main Apr 22, 2026
3 of 6 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.

Theme - Dark Mode Flicker

2 participants