fix(ui): apply the saved theme before paint to avoid a light flash#360
fix(ui): apply the saved theme before paint to avoid a light flash#360cavidelizade wants to merge 1 commit 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>
|
Warning Review limit reached
Next review available in: 5 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
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