Skip to content

Fix icon theme not updating on reload after Dark/Light mode switch#3493

Open
jmcouffin with Copilot wants to merge 1 commit into
developfrom
copilot/propose-alternative-icon-caching
Open

Fix icon theme not updating on reload after Dark/Light mode switch#3493
jmcouffin with Copilot wants to merge 1 commit into
developfrom
copilot/propose-alternative-icon-caching

Conversation

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

RevitThemeDetector stores the detected Revit UI theme in static fields, so after switching themes mid-session the stale value persists for the process lifetime — a full Revit restart was required to see correct icons.

Change

Clear the theme cache at the start of each LoadSession() so the active theme is re-queried on every reload:

// SessionManagerService.LoadSession()
_extensionManager?.ClearParserCaches();
RevitThemeDetector.ClearCache();   // ← added

The cache is repopulated on the first IsDarkTheme() call within that same load, so there is no performance regression. After this change, a pyRevit reload is sufficient to pick up a Dark ↔ Light mode switch.

@devloai

devloai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Unable to trigger custom agent "Code Reviewer". You have run out of credits 😔
Please upgrade your plan or buy additional credits from the subscription page.

Copilot AI changed the title Fix stale icon theme cache: reload now picks up Dark/Light mode switch Fix icon theme not updating on reload after Dark/Light mode switch Jul 20, 2026
Copilot AI requested a review from jmcouffin July 20, 2026 18:05
@jmcouffin

Copy link
Copy Markdown
Contributor

Fixes #3361

@jmcouffin
jmcouffin marked this pull request as ready for review July 20, 2026 20:07
@jmcouffin

Copy link
Copy Markdown
Contributor

@romangolev @Wurschdhaud @tay0thman what are you thoughts on this? Shall we leave it as is and document it in the reload button tooltip or adjust the behavior following this PR?

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