-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
Description
Summary
ThemeProvider is a custom theme management system with light/dark mode, localStorage persistence, and system preference detection. Has TypeScript safety issues, stale closure bugs, and obsolete CSS.
Improvements
1. Remove @ts-ignore comments (lines 95, 168)
Two TypeScript suppressions without explanation. Should use proper type assertions or fix the underlying type mismatch.
2. Fix missing useCallback dependencies
setThemecallback (line 125) is missingstorageKeyin dependency array — can cause stale closure bugshandleMediaQuerycallback (line 137) is missingenableSystemdependency
3. Fix invalid JavaScript string generation (line 278)
val construction uses name + "|| ''" which creates syntactically invalid JavaScript in the injected script.
4. Remove obsolete -o- vendor prefix
CSS transition disabling string includes Opera prefix (-o-transition) which is unnecessary in modern browsers.
5. Add onThemeChange callback
No event hook for applications that need to react to theme changes.
6. Centralize hardcoded default values
Defaults (style = 'modern', accentColor = 'indigo', grayColor = 'gray', storageKey = 'theme') are scattered. Consider named constants.
Files
packages/raystack/raystack/components/theme-provider/
Reactions are currently unavailable