[WEB-575] chore: safely re-enable SWR (#3805)

* safley enable swr and make sure to minimalize re renders

* resolve build errors

* fix dropdowns updation by adding observer
This commit is contained in:
rahulramesha
2024-02-28 15:18:11 +05:30
committed by GitHub
parent bd142989b4
commit 6c70d3854a
49 changed files with 952 additions and 1173 deletions

View File

@@ -28,6 +28,7 @@ export interface ICycleStore {
currentProjectActiveCycleId: string | null;
// computed actions
getCycleById: (cycleId: string) => ICycle | null;
getCycleNameById: (cycleId: string) => string | undefined;
getActiveCycleById: (cycleId: string) => ICycle | null;
getProjectCycleIds: (projectId: string) => string[] | null;
// actions
@@ -189,6 +190,13 @@ export class CycleStore implements ICycleStore {
*/
getCycleById = computedFn((cycleId: string): ICycle | null => this.cycleMap?.[cycleId] ?? null);
/**
* @description returns cycle name by cycle id
* @param cycleId
* @returns
*/
getCycleNameById = computedFn((cycleId: string): string => this.cycleMap?.[cycleId]?.name);
/**
* @description returns active cycle details by cycle id
* @param cycleId

View File

@@ -19,6 +19,7 @@ export interface IModuleStore {
projectModuleIds: string[] | null;
// computed actions
getModuleById: (moduleId: string) => IModule | null;
getModuleNameById: (moduleId: string) => string;
getProjectModuleIds: (projectId: string) => string[] | null;
// actions
// fetch
@@ -114,6 +115,13 @@ export class ModulesStore implements IModuleStore {
*/
getModuleById = computedFn((moduleId: string) => this.moduleMap?.[moduleId] || null);
/**
* @description get module by id
* @param moduleId
* @returns IModule | null
*/
getModuleNameById = computedFn((moduleId: string) => this.moduleMap?.[moduleId]?.name);
/**
* @description returns list of module ids of the project id passed as argument
* @param projectId

View File

@@ -24,6 +24,7 @@ export interface IProjectStore {
// actions
setSearchQuery: (query: string) => void;
getProjectById: (projectId: string) => IProject | null;
getProjectIdentifierById: (projectId: string) => string;
// fetch actions
fetchProjects: (workspaceSlug: string) => Promise<IProject[]>;
fetchProjectDetails: (workspaceSlug: string, projectId: string) => Promise<any>;
@@ -210,6 +211,16 @@ export class ProjectStore implements IProjectStore {
return projectInfo;
});
/**
* Returns project identifier using project id
* @param projectId
* @returns string
*/
getProjectIdentifierById = computedFn((projectId: string) => {
const projectInfo = this.projectMap?.[projectId];
return projectInfo?.identifier;
});
/**
* Adds project to favorites and updates project favorite status in the store
* @param workspaceSlug