Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

add observeSome to state cache service

Oliver Günther2eb0ce3dfafe
diff --git a/frontend/src/app/core/apiv3/cache/state-cache.service.ts b/frontend/src/app/core/apiv3/cache/state-cache.service.ts
index 569613b2c39..51cbe323311 100644
--- a/frontend/src/app/core/apiv3/cache/state-cache.service.ts
+++ b/frontend/src/app/core/apiv3/cache/state-cache.service.ts
@@ -26,13 +26,21 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-import { MultiInputState, State } from '@openproject/reactivestates';
import {
+ MultiInputState,
+ State,
+} from '@openproject/reactivestates';
+import {
+ combineLatest,
firstValueFrom,
Observable,
} from 'rxjs';
import {
- auditTime, map, share, startWith, take,
+ auditTime,
+ map,
+ share,
+ startWith,
+ take,
} from 'rxjs/operators';
export interface HasId {
@@ -143,6 +151,10 @@ export class StateCacheService<T> {
);
}
+ observeSome(ids:string[]):Observable<T[]> {
+ return combineLatest(ids.map((id) => this.observe(id)));
+ }
+
/**
* Clear a set of cached states.
* @param ids