Skip to content
Snippets Groups Projects
Commit 4592ef68 authored by Florent Poittevin's avatar Florent Poittevin
Browse files

fix: wrong theme selected when setting override

parent 5acba934
No related branches found
No related tags found
No related merge requests found
......@@ -84,6 +84,7 @@ export class AppComponent extends SharedAbstractPresentational {
this.listenCurrentModule();
this.listenThemeChange();
this.observeOfflineOnlineMode();
this.themeChange(environment.theme);
}
private observeOfflineOnlineMode(): void {
......@@ -186,7 +187,9 @@ export class AppComponent extends SharedAbstractPresentational {
}
themeChange(theme: ThemeEnum): void {
this.store.dispatch(new AppAction.ChangeAppTheme(theme));
if (theme !== this.store.selectSnapshot((state: LocalStateModel) => state.application.theme)) {
this.store.dispatch(new AppAction.ChangeAppTheme(theme));
}
}
navigateToHome(): void {
......@@ -196,6 +199,7 @@ export class AppComponent extends SharedAbstractPresentational {
private listenThemeChange(): void {
this.subscribe(
this.themeObs.pipe(
distinctUntilChanged(),
tap((theme: ThemeEnum) => {
this.setTheme();
this.setFavicon();
......
......@@ -37,7 +37,9 @@ export class ThemeSelectorPresentational extends SharedAbstractPresentational {
}
private set _theme(value: ThemeEnum | undefined) {
this._themeBS.next(value);
if (this._themeBS.value !== value) {
this._themeBS.next(value);
}
}
get theme(): ThemeEnum | undefined {
......@@ -52,5 +54,4 @@ export class ThemeSelectorPresentational extends SharedAbstractPresentational {
get stringUtil(): typeof StringUtil {
return StringUtil;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment