Skip to content

[6.x] Fix theme resetting after leaving preferences page - #15579

Merged
jasonvarga merged 2 commits into
6.xfrom
preferences-theme-reset
Oct 5, 2026
Merged

jasonvarga merged 2 commits into
6.xfrom
preferences-theme-reset

Conversation

@duncanmcclean

@duncanmcclean duncanmcclean commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

This pull request fixes an issue where the Control Panel would switch back to the default theme after visiting the preferences page and navigating elsewhere, until the page was refreshed.

This was happening because, when the theme selector was unmounted, it re-applied the theme from the field's initial value. However, the preferences page only contains the preferences saved at that level (eg. the user's own preferences), so when the theme was inherited from a role or the default preferences, the field was empty and the default theme was applied.

This PR fixes it by remembering the server-rendered theme colors when the selector is mounted and restoring them when it's unmounted. Saving preferences reloads the page, so restoring the original colors is always correct.

Before

CleanShot.2026-10-05.at.08.58.31.mp4

After

CleanShot.2026-10-05.at.09.00.49.mp4

@jasonvarga
jasonvarga merged commit 0f2dc59 into 6.x Oct 5, 2026
64 checks passed
@jasonvarga
jasonvarga deleted the preferences-theme-reset branch October 5, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants