From 98a1eaa771f0fcc9c19cdd49269ff682e0c21cb4 Mon Sep 17 00:00:00 2001 From: felix bear Date: Tue, 9 Jun 2026 18:27:54 +0900 Subject: [PATCH] refactor(time-tracking): replace toPromise usage (#8200) Co-authored-by: cocojojo5213 --- .../features/time-tracking/time-tracking.service.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/features/time-tracking/time-tracking.service.ts b/src/app/features/time-tracking/time-tracking.service.ts index dbdde4cbbe..415787fa7c 100644 --- a/src/app/features/time-tracking/time-tracking.service.ts +++ b/src/app/features/time-tracking/time-tracking.service.ts @@ -1,7 +1,7 @@ import { inject, Injectable } from '@angular/core'; -import { combineLatest, Observable, Subject } from 'rxjs'; +import { combineLatest, firstValueFrom, Observable, Subject } from 'rxjs'; import { TimeTrackingState, TTDateMap, TTWorkContextData } from './time-tracking.model'; -import { first, map, shareReplay, startWith, switchMap } from 'rxjs/operators'; +import { map, shareReplay, startWith, switchMap } from 'rxjs/operators'; import { mergeTimeTrackingStates } from './merge-time-tracking-states'; import { Store } from '@ngrx/store'; import { selectTimeTrackingState } from './store/time-tracking.selectors'; @@ -72,7 +72,7 @@ export class TimeTrackingService { } async cleanupDataEverywhereForProject(projectId: string): Promise { - const current = await this.current$.pipe(first()).toPromise(); + const current = await firstValueFrom(this.current$); const archiveYoung = await this._archiveDbAdapter.loadArchiveYoung(); const archiveOld = await this._archiveDbAdapter.loadArchiveOld(); @@ -108,7 +108,7 @@ export class TimeTrackingService { * Current state cleanup is now handled atomically in tag-shared.reducer.ts. */ async cleanupDataEverywhereForTag(tagId: string): Promise { - const current = await this.current$.pipe(first()).toPromise(); + const current = await firstValueFrom(this.current$); const archiveYoung = await this._archiveDbAdapter.loadArchiveYoung(); const archiveOld = await this._archiveDbAdapter.loadArchiveOld(); @@ -163,7 +163,7 @@ export class TimeTrackingService { id: string; type: WorkContextType; }): Promise> { - return this.getWorkStartEndForWorkContext$(ctx).pipe(first()).toPromise(); + return firstValueFrom(this.getWorkStartEndForWorkContext$(ctx)); } async getLegacyWorkStartEndForWorkContext(ctx: {