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

Move to multiInput for cache

Klaus Zanders42e27f4ed741
diff --git a/frontend/src/app/features/work-packages/directives/query-space/isolated-query-space.ts b/frontend/src/app/features/work-packages/directives/query-space/isolated-query-space.ts
index 8c2a55df175..24c250ddbf7 100644
--- a/frontend/src/app/features/work-packages/directives/query-space/isolated-query-space.ts
+++ b/frontend/src/app/features/work-packages/directives/query-space/isolated-query-space.ts
@@ -2,6 +2,7 @@ import {
derive,
input,
InputState,
+ multiInput,
State,
StatesGroup,
} from '@openproject/reactivestates';
@@ -64,7 +65,7 @@ export class IsolatedQuerySpace extends StatesGroup {
additionalRequiredWorkPackages = input<null>();
// Cached shares for work packages
- workPackageSharesCache = input<ShareResource[]>();
+ workPackageSharesCache = multiInput<ShareResource[]>();
// Input state that emits whenever table services have initialized
initialized = input<unknown>();
diff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-additional-elements.service.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-additional-elements.service.ts
index 83fb2490b12..f8d5e4fc448 100644
--- a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-additional-elements.service.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-additional-elements.service.ts
@@ -162,7 +162,12 @@ export class WorkPackageViewAdditionalElementsService {
.get()
.subscribe(({ elements }) => {
const shares = elements as ShareResource[];
- this.querySpace.workPackageSharesCache.putValue(shares);
+
+ const sharedWpIds = _.uniq(shares.map((share) => share.entity.id as string));
+
+ sharedWpIds.forEach((wpId) => {
+ this.querySpace.workPackageSharesCache.get(wpId).putValue(shares.filter((share) => share.entity.id === wpId));
+ });
});
return Promise.resolve([]);