Skip to content

Commit

Permalink
fix: apply active themes after features updated
Browse files Browse the repository at this point in the history
  • Loading branch information
moughxyz committed Feb 22, 2022
1 parent af69a02 commit 3d6c10b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions app/assets/javascripts/services/themeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class ThemeManager extends ApplicationService {
break;
}
case ApplicationEvent.FeaturesUpdated: {
this.reloadThemeStatus();
this.handleFeaturesUpdated();
break;
}
case ApplicationEvent.Launched: {
Expand Down Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down

0 comments on commit 3d6c10b

Please sign in to comment.