Skip to content

[ThemeProvider] Fix callback dependencies and add onThemeChange callback #646

@ravisuhag

Description

@ravisuhag

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

2. Fix missing useCallback dependencies

  • setTheme callback (line 125) is missing storageKey in dependency array — can cause stale closure bugs
  • handleMediaQuery callback (line 137) is missing enableSystem dependency

3. Fix invalid JavaScript string generation (line 278)

val construction uses name + "|| ''" which creates syntactically invalid JavaScript in the injected script.

5. Add onThemeChange callback

No event hook for applications that need to react to theme changes.

Moved to Cross-Cutting Issues

The following items have been moved to cross-cutting issues that address them across all components:

Files

  • packages/raystack/raystack/components/theme-provider/

Metadata

Metadata

Assignees

No one assigned

    Labels

    globalCross-cutting issue affecting multiple componentstriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions