Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

improvement: update fetch map during workspace-level module fetch to reduce redundant API calls (#6159)

Prateek Shouryaaa1e192a5095
diff --git a/web/core/store/module.store.ts b/web/core/store/module.store.ts
index f7a99a5c43..23f2af6720 100644
--- a/web/core/store/module.store.ts
+++ b/web/core/store/module.store.ts
@@ -39,7 +39,7 @@ export interface IModuleStore {
updateModuleDistribution: (distributionUpdates: DistributionUpdates, moduleId: string) => void;
fetchWorkspaceModules: (workspaceSlug: string) => Promise<IModule[]>;
fetchModules: (workspaceSlug: string, projectId: string) => Promise<undefined | IModule[]>;
- fetchModulesSlim: (workspaceSlug: string, projectId: string) => Promise<undefined | IModule[]>
+ fetchModulesSlim: (workspaceSlug: string, projectId: string) => Promise<undefined | IModule[]>;
fetchArchivedModules: (workspaceSlug: string, projectId: string) => Promise<undefined | IModule[]>;
fetchArchivedModuleDetails: (workspaceSlug: string, projectId: string, moduleId: string) => Promise<IModule>;
fetchModuleDetails: (workspaceSlug: string, projectId: string, moduleId: string) => Promise<IModule>;
@@ -253,6 +253,11 @@ export class ModulesStore implements IModuleStore {
response.forEach((module) => {
set(this.moduleMap, [module.id], { ...this.moduleMap[module.id], ...module });
});
+ // check for all unique project ids and update the fetchedMap
+ const uniqueProjectIds = new Set(response.map((module) => module.project_id));
+ uniqueProjectIds.forEach((projectId) => {
+ set(this.fetchedMap, projectId, true);
+ });
});
return response;
});