From 8c2eff2b5a0ad0654e13485cf16a0876d6de0c52 Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Sat, 23 May 2026 12:44:05 +0700 Subject: [PATCH] fix(client): remove nested subscription --- .../home-summary/home-summary.component.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/apps/client/src/app/components/home-summary/home-summary.component.ts b/apps/client/src/app/components/home-summary/home-summary.component.ts index 28fbc1ae4..c8d6d2787 100644 --- a/apps/client/src/app/components/home-summary/home-summary.component.ts +++ b/apps/client/src/app/components/home-summary/home-summary.component.ts @@ -18,6 +18,7 @@ import { import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { MatCardModule } from '@angular/material/card'; import { DeviceDetectorService } from 'ngx-device-detector'; +import { switchMap } from 'rxjs'; @Component({ changeDetection: ChangeDetectionStrategy.OnPush, @@ -75,14 +76,12 @@ export class GfHomeSummaryComponent implements OnInit { protected onChangeEmergencyFund(emergencyFund: number) { this.dataService .putUserSetting({ emergencyFund }) - .pipe(takeUntilDestroyed(this.destroyRef)) - .subscribe(() => { - this.userService - .get(true) - .pipe(takeUntilDestroyed(this.destroyRef)) - .subscribe((user) => { - this.user.set(user); - }); + .pipe( + switchMap(() => this.userService.get(true)), + takeUntilDestroyed(this.destroyRef) + ) + .subscribe((user) => { + this.user.set(user); }); }