fix: normalize the landing-draft theme-toggle's persisted localStorage value - #511
Conversation
Only accept a stored slashed-home-theme value if it's one of the known states (auto/dark/light). Guards against a stale or tampered value driving an invalid data-theme attribute and a garbage toggle-button label. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016rBJXkhpA2ZvDxsoRWFZGG
|
Warning Review limit reached
Next review available in: 32 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 |
PR Summary by QodoFix theme toggle: validate persisted localStorage value before applying
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Summary
Replaces #504, which described a full landing-page redesign but whose actual diff against
mainwas just this one fix — every other feature it described (hero animation, CDN load, token demos, dark install band, Jekyll exclusion) was already merged intomainvia earlier commits shared by both branches, so closing or merging #504 wouldn't have changed anything else incopy-wip/github-pages-index.html. Opening this standalone PR with just the actual remaining change, and closing #504.Fix
current = localStorage.getItem('slashed-home-theme') || 'auto';accepted any truthy stored string unconditionally. If the value ever isn't one of the three known states (auto/dark/light) — e.g. a stale value from a future rename of thestatesarray, or manual tampering via devtools —apply(current)would set an unmatcheddata-themeattribute (silently falls back to OS-preference styling) and stamp the toggle button's label with that raw string.Now only accepts the stored value if it's one of the known states, otherwise keeps the
'auto'default.🤖 Generated with Claude Code
Generated by Claude Code