Repository navigation
fix(theme): Validate localStorage theme to prevent DOMTokenList error - #4136
sentry[bot] wants to merge 1 commit into
Conversation
|
The Sentry GitHub App installation for this repository is missing permissions it needs to keep iterating on this pull request to get CI passing. Review and accept the updated permissions to let Seer continue: https://github.com/organizations/codecov/settings/installations/86101127/permissions/update |
Bundle ReportChanges will increase total bundle size by 89 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: gazebo-production-esmAssets Changed:
Files in
view changes for bundle: gazebo-production-systemAssets Changed:
Files in
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #4136 +/- ##
=======================================
Coverage 98.77% 98.77%
=======================================
Files 823 823
Lines 15147 15150 +3
Branches 4387 4389 +2
=======================================
+ Hits 14961 14964 +3
Misses 179 179
Partials 7 7
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #4136 +/- ##
=======================================
Coverage 98.77% 98.77%
=======================================
Files 823 823
Lines 15147 15150 +3
Branches 4379 4389 +10
=======================================
+ Hits 14961 14964 +3
Misses 179 179
Partials 7 7
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4136 +/- ##
=======================================
Coverage 98.77% 98.77%
=======================================
Files 823 823
Lines 15147 15150 +3
Branches 4387 4389 +2
=======================================
+ Hits 14961 14964 +3
Misses 179 179
Partials 7 7
Continue to review full report in Codecov by Harness.
|
✅ Deploy preview for gazebo ready!Previews expire after 1 month automatically.
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #4136 +/- ##
=======================================
Coverage 98.77% 98.77%
=======================================
Files 823 823
Lines 15147 15150 +3
Branches 4387 4389 +2
=======================================
+ Hits 14961 14964 +3
Misses 179 179
Partials 7 7
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Description
This PR addresses an
InvalidCharacterErrorthat occurs whendocument.body.classList.add()is called with athemevalue containing whitespace. The root cause was that thelocalStorage.getItem('theme') as Themecast inThemeContextProviderwas a compile-time assertion, providing no runtime validation for potentially malformed values stored inlocalStorage.The fix introduces a runtime validation check (
isValidTheme) insrc/shared/ThemeContext/ThemeContext.tsx. This ensures that only validThemeenum values ('light'or'dark') are used. If the value retrieved fromlocalStorageis invalid (e.g., contains whitespace or is not 'light'/'dark'), it now gracefully falls back tonull, which then defaults to the system-detected theme, preventing theInvalidCharacterError.Code Example
Notable Changes
isValidTheme) for theme values retrieved fromlocalStorage.Themeenum values ('light'or'dark') are used.null(triggering system theme default) for invalidlocalStoragetheme values.InvalidCharacterErrorwhen adding theme class todocument.body.classList.Screenshots
Link to Sample Entry
Legal Boilerplate
Look, I get it. The entity doing business as "Codecov" is owned by Harness, Inc. In 2026 Harness acquired Codecov and as a result Harness is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Harness can use, modify, copy, and redistribute my contributions, under Harness's choice of terms.
Fixes GAZEBO-188A
@sentry <feedback>: Autofix iterates on these changes@sentry stop iterating: Autofix stops iterating on this runThis PR was automatically generated by Sentry. You can adjust this setting at any time.