mirror of
https://github.com/makeplane/plane.git
synced 2026-04-24 17:18:57 -05:00
improvement: update fetch map during workspace-level module fetch to reduce redundant API calls (#6159)
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user