diff --git a/.vscode/settings.json b/.vscode/settings.json index d12cbc646..9bf4d12b5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,4 @@ { "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true, - "angular.enable-strict-mode-prompt": false + "editor.formatOnSave": true } diff --git a/apps/client/src/app/components/home-overview/home-overview.component.ts b/apps/client/src/app/components/home-overview/home-overview.component.ts index 4bec9d404..9baf83dcf 100644 --- a/apps/client/src/app/components/home-overview/home-overview.component.ts +++ b/apps/client/src/app/components/home-overview/home-overview.component.ts @@ -36,7 +36,6 @@ export class HomeOverviewComponent implements OnDestroy, OnInit { public showDetails = false; public unit: string; public user: User; - private subscription: Subscription; private unsubscribeSubject = new Subject(); @@ -44,8 +43,8 @@ export class HomeOverviewComponent implements OnDestroy, OnInit { private changeDetectorRef: ChangeDetectorRef, private dataService: DataService, private deviceService: DeviceDetectorService, - private layoutService: LayoutService, private impersonationStorageService: ImpersonationStorageService, + private layoutService: LayoutService, private userService: UserService ) { this.userService.stateChanged @@ -82,9 +81,11 @@ export class HomeOverviewComponent implements OnDestroy, OnInit { this.unit = this.showDetails ? this.user.settings.baseCurrency : '%'; - this.subscription = this.layoutService.shouldReload$.subscribe(() => { - this.update(); - }); + this.layoutService.shouldReload$ + .pipe(takeUntil(this.unsubscribeSubject)) + .subscribe(() => { + this.update(); + }); } public onChangeDateRange(dateRange: DateRange) { @@ -108,9 +109,6 @@ export class HomeOverviewComponent implements OnDestroy, OnInit { public ngOnDestroy() { this.unsubscribeSubject.next(); this.unsubscribeSubject.complete(); - if (this.subscription) { - this.subscription.unsubscribe(); - } } private update() { diff --git a/apps/client/src/app/core/layout.service.ts b/apps/client/src/app/core/layout.service.ts index 6c17bbfa0..24fbc0fb8 100644 --- a/apps/client/src/app/core/layout.service.ts +++ b/apps/client/src/app/core/layout.service.ts @@ -10,7 +10,7 @@ export class LayoutService { // Observable stream public shouldReload$ = this.shouldReloadSubject.asObservable(); - constructor() {} + public constructor() {} // Method to trigger the reload public triggerReload() {