Repository navigation
fix(ui): apply the saved theme before paint to avoid a light flash - #360
Open
cavidelizade wants to merge 4 commits into
Open
cavidelizade wants to merge 4 commits into
cavidelizade wants to merge 4 commits into
Conversation
index.html hardcoded data-theme="light" and the real theme was only applied once React ran, so dark and pink users saw a flash of light on every load. Add a tiny blocking script in the head that reads devlane-theme from localStorage (same key, values and system fallback as ThemeContext) and sets data-theme before the bundle paints. Closes Devlaner#348 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 31 minutes. View limit details
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Users with a dark or pink theme saw a flash of the light theme on every page load.
Linked issues
Closes #348
Type of change
fix:)Surface
apps/web/)What changed
index.htmlhardcodeddata-theme="light"and the real theme was only reconciled once React ran (auseLayoutEffectinThemeContext). Added a small blocking script in the<head>that readsdevlane-themefrom localStorage, mirrorsThemeContext's values and system fallback, and setsdata-themebefore the bundle paints. Dropped the hardcodeddata-theme="light"since the script now owns it (and light is the attribute-less default).Test plan
npm run buildsucceedsdevlane-themeset to dark, a reload paints dark immediately instead of flashing lightNotes
The issue also mentions cross-tab sync via the
storageevent. Left that out to keep this focused on the flash, happy to add it if you want it here.AI assistance
Claude Code (Opus 4.8), commits carry aCo-Authored-By:trailer