From 3d6c10b70eb56cc5ab0be4e0cc25a58d5b590da1 Mon Sep 17 00:00:00 2001 From: Mo Date: Tue, 22 Feb 2022 14:03:28 -0600 Subject: [PATCH] fix: apply active themes after features updated --- app/assets/javascripts/services/themeManager.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/services/themeManager.ts b/app/assets/javascripts/services/themeManager.ts index 56d3aa172..11d0262c8 100644 --- a/app/assets/javascripts/services/themeManager.ts +++ b/app/assets/javascripts/services/themeManager.ts @@ -84,7 +84,7 @@ export class ThemeManager extends ApplicationService { break; } case ApplicationEvent.FeaturesUpdated: { - this.reloadThemeStatus(); + this.handleFeaturesUpdated(); break; } case ApplicationEvent.Launched: { @@ -119,7 +119,7 @@ export class ThemeManager extends ApplicationService { super.deinit(); } - private reloadThemeStatus(): void { + private handleFeaturesUpdated(): void { let hasChange = false; for (const themeUuid of this.activeThemes) { const theme = this.application.findItem(themeUuid) as SNTheme; @@ -139,6 +139,17 @@ export class ThemeManager extends ApplicationService { } } + const activeThemes = ( + this.application.getItems(ContentType.Theme) as SNTheme[] + ).filter((theme) => theme.active); + + for (const theme of activeThemes) { + if (!this.activeThemes.includes(theme.uuid)) { + this.activateTheme(theme); + hasChange = true; + } + } + if (hasChange) { this.cacheThemeState(); }