fix: always use chonkDarkTheme in gsAdmin#104338
Conversation
| themes[themeName] ?? lightTheme, | ||
| toggleTheme, | ||
| ] as const; | ||
| return [themeName === 'darkTheme', themes[themeName], toggleTheme] as const; |
There was a problem hiding this comment.
Bug: Missing fallback for invalid localStorage theme value
The removal of the fallback ?? lightTheme creates a potential issue. If localStorage contains an invalid value for getsentryAdminTheme (not 'darkTheme' or 'lightTheme'), themes[themeName] will be undefined since the as ThemeName cast doesn't validate the actual value at runtime. This would cause theme to be undefined when passed to ThemeProvider, potentially breaking the admin layout. The original fallback protected against corrupted or manually modified localStorage values.
There was a problem hiding this comment.
There is a fallback to localStorage.getItem above which initializes to lightTheme. This line can only be hit if we store or read a corrupt value from localstorage. We can dismiss this comment
No description provided.