From 3bfec3de0011ab9487fc480ad4c5da2b50c3f691 Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Fri, 22 Sep 2023 15:35:26 +0200 Subject: [PATCH] fix: metrics bug when switching projects directly #2790 --- src/app/features/metric/project-metrics.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/features/metric/project-metrics.service.ts b/src/app/features/metric/project-metrics.service.ts index dc347bde838..cbf9644f1c0 100644 --- a/src/app/features/metric/project-metrics.service.ts +++ b/src/app/features/metric/project-metrics.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { combineLatest, EMPTY, from, Observable } from 'rxjs'; import { SimpleMetrics } from './metric.model'; -import { map, switchMap, take } from 'rxjs/operators'; +import { delay, map, switchMap, take } from 'rxjs/operators'; import { WorkContextType } from '../work-context/work-context.model'; import { mapSimpleMetrics } from './metric.util'; import { TaskService } from '../tasks/task.service'; @@ -15,6 +15,8 @@ import { WorkContextService } from '../work-context/work-context.service'; export class ProjectMetricsService { simpleMetrics$: Observable = this._workContextService.activeWorkContextTypeAndId$.pipe( + // wait for current projectId to settle in :( + delay(100), switchMap(({ activeType, activeId }) => { return activeType === WorkContextType.PROJECT ? combineLatest([