Skip to content

fix: auto-refresh themes UI when navigating to settings page (@byseif21) #6581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

byseif21
Copy link
Contributor

Description

When (changing / adding or removing themes from favorite ) via command line or from the current theme button "in page e.g test page" and then
navigating to Settings > Themes, the UI does not immediately reflect the current theme changes . The user has to manually refresh the page to see these changes.

Now
UI automatically refreshes
to reflect the current theme selection and favorites without requiring
a manual page refresh.

  • Added refreshThemeUI function in theme-picker.ts that updates all
    theme-related UI components
  • Called this refresh function in the settings page's beforeShow lifecycle hook to ensure the theme UI is always up-to-date when the page is displayed.

FOR TESTING BEFORE & AFTER:
keep changing themes then navigate to the settings and check and keep doing those things again to verify that the active theme and favorites update.

@monkeytypegeorge monkeytypegeorge added the frontend User interface or web stuff label May 20, 2025
@Miodec
Copy link
Member

Miodec commented May 29, 2025

This change will cause multiple calls to refreshCustomButtons / refreshPresetButtons on first load. This needs to be done another way.

byseif21 added 3 commits May 30, 2025 00:44
Added themeUIInitialized flag to avoid multiple calls to refreshCustomButtons and refreshPresetButtons. Ensures proper state reset only when necessary.
@byseif21
Copy link
Contributor Author

This change will cause multiple calls to refreshCustomButtons / refreshPresetButtons on first load. This needs to be done another way.

hey mio check this approach and tell me what do you think of it !

I’ve added a flag to track whether the UI has already been set up. Now refreshThemeUI() skips redundant work unless the state is explicitly reset, I kept thinking for other ways like an event-based approach or refactor the theme UI with lifecycle methods, but this is the one with minimal changes I feel, so let me know what do you feel about that and if you spot any edge cases I might’ve missed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend User interface or web stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants