mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: remove active ids from the MobX stores if not present in the route (#2681)
* chore: remove active ids if not present in the route * refactor: set active id logic
This commit is contained in:
parent
df8bdfd5b9
commit
83e0c4ebbd
@ -62,12 +62,13 @@ const MobxStoreInit = observer(() => {
|
|||||||
*/
|
*/
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (workspaceSlug) setWorkspaceSlug(workspaceSlug.toString());
|
if (workspaceSlug) setWorkspaceSlug(workspaceSlug.toString());
|
||||||
if (projectId) setProjectId(projectId.toString());
|
|
||||||
if (cycleId) setCycleId(cycleId.toString());
|
setProjectId(projectId?.toString() ?? null);
|
||||||
if (moduleId) setModuleId(moduleId.toString());
|
setCycleId(cycleId?.toString() ?? null);
|
||||||
if (globalViewId) setGlobalViewId(globalViewId.toString());
|
setModuleId(moduleId?.toString() ?? null);
|
||||||
if (viewId) setViewId(viewId.toString());
|
setGlobalViewId(globalViewId?.toString() ?? null);
|
||||||
if (inboxId) setInboxId(inboxId.toString());
|
setViewId(viewId?.toString() ?? null);
|
||||||
|
setInboxId(inboxId?.toString() ?? null);
|
||||||
}, [
|
}, [
|
||||||
workspaceSlug,
|
workspaceSlug,
|
||||||
projectId,
|
projectId,
|
||||||
|
@ -32,7 +32,7 @@ export interface ICycleStore {
|
|||||||
// actions
|
// actions
|
||||||
setCycleView: (_cycleView: TCycleView) => void;
|
setCycleView: (_cycleView: TCycleView) => void;
|
||||||
setCycleLayout: (_cycleLayout: TCycleLayout) => void;
|
setCycleLayout: (_cycleLayout: TCycleLayout) => void;
|
||||||
setCycleId: (cycleId: string) => void;
|
setCycleId: (cycleId: string | null) => void;
|
||||||
|
|
||||||
validateDate: (workspaceSlug: string, projectId: string, payload: CycleDateCheckData) => Promise<any>;
|
validateDate: (workspaceSlug: string, projectId: string, payload: CycleDateCheckData) => Promise<any>;
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ export class CycleStore implements ICycleStore {
|
|||||||
// actions
|
// actions
|
||||||
setCycleView = (_cycleView: TCycleView) => (this.cycleView = _cycleView);
|
setCycleView = (_cycleView: TCycleView) => (this.cycleView = _cycleView);
|
||||||
setCycleLayout = (_cycleLayout: TCycleLayout) => (this.cycleLayout = _cycleLayout);
|
setCycleLayout = (_cycleLayout: TCycleLayout) => (this.cycleLayout = _cycleLayout);
|
||||||
setCycleId = (cycleId: string) => (this.cycleId = cycleId);
|
setCycleId = (cycleId: string | null) => (this.cycleId = cycleId);
|
||||||
|
|
||||||
validateDate = async (workspaceSlug: string, projectId: string, payload: CycleDateCheckData) => {
|
validateDate = async (workspaceSlug: string, projectId: string, payload: CycleDateCheckData) => {
|
||||||
try {
|
try {
|
||||||
|
@ -19,7 +19,7 @@ export interface IGlobalViewsStore {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
setGlobalViewId: (viewId: string) => void;
|
setGlobalViewId: (viewId: string | null) => void;
|
||||||
|
|
||||||
fetchAllGlobalViews: (workspaceSlug: string) => Promise<IWorkspaceView[]>;
|
fetchAllGlobalViews: (workspaceSlug: string) => Promise<IWorkspaceView[]>;
|
||||||
fetchGlobalViewDetails: (workspaceSlug: string, viewId: string) => Promise<IWorkspaceView>;
|
fetchGlobalViewDetails: (workspaceSlug: string, viewId: string) => Promise<IWorkspaceView>;
|
||||||
@ -72,7 +72,7 @@ export class GlobalViewsStore implements IGlobalViewsStore {
|
|||||||
this.workspaceService = new WorkspaceService();
|
this.workspaceService = new WorkspaceService();
|
||||||
}
|
}
|
||||||
|
|
||||||
setGlobalViewId = (viewId: string) => {
|
setGlobalViewId = (viewId: string | null) => {
|
||||||
this.globalViewId = viewId;
|
this.globalViewId = viewId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ export interface IInboxStore {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
setInboxId: (inboxId: string) => void;
|
setInboxId: (inboxId: string | null) => void;
|
||||||
|
|
||||||
getInboxId: (projectId: string) => string | null;
|
getInboxId: (projectId: string) => string | null;
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ export class InboxStore implements IInboxStore {
|
|||||||
return this.inboxesList[projectId]?.[0]?.id ?? null;
|
return this.inboxesList[projectId]?.[0]?.id ?? null;
|
||||||
};
|
};
|
||||||
|
|
||||||
setInboxId = (inboxId: string) => {
|
setInboxId = (inboxId: string | null) => {
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
this.inboxId = inboxId;
|
this.inboxId = inboxId;
|
||||||
});
|
});
|
||||||
|
@ -34,7 +34,7 @@ export interface IModuleStore {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
setModuleId: (moduleSlug: string) => void;
|
setModuleId: (moduleId: string | null) => void;
|
||||||
|
|
||||||
getModuleById: (moduleId: string) => IModule | null;
|
getModuleById: (moduleId: string) => IModule | null;
|
||||||
|
|
||||||
@ -144,8 +144,8 @@ export class ModuleStore implements IModuleStore {
|
|||||||
getModuleById = (moduleId: string) => this.moduleDetails[moduleId] || null;
|
getModuleById = (moduleId: string) => this.moduleDetails[moduleId] || null;
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
setModuleId = (moduleSlug: string) => {
|
setModuleId = (moduleId: string | null) => {
|
||||||
this.moduleId = moduleSlug ?? null;
|
this.moduleId = moduleId;
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchModules = async (workspaceSlug: string, projectId: string) => {
|
fetchModules = async (workspaceSlug: string, projectId: string) => {
|
||||||
|
@ -20,7 +20,7 @@ export interface IProjectViewsStore {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
setViewId: (viewId: string) => void;
|
setViewId: (viewId: string | null) => void;
|
||||||
|
|
||||||
fetchAllViews: (workspaceSlug: string, projectId: string) => Promise<IProjectView[]>;
|
fetchAllViews: (workspaceSlug: string, projectId: string) => Promise<IProjectView[]>;
|
||||||
fetchViewDetails: (workspaceSlug: string, projectId: string, viewId: string) => Promise<IProjectView>;
|
fetchViewDetails: (workspaceSlug: string, projectId: string, viewId: string) => Promise<IProjectView>;
|
||||||
@ -82,7 +82,7 @@ export class ProjectViewsStore implements IProjectViewsStore {
|
|||||||
this.viewService = new ViewService();
|
this.viewService = new ViewService();
|
||||||
}
|
}
|
||||||
|
|
||||||
setViewId = (viewId: string) => {
|
setViewId = (viewId: string | null) => {
|
||||||
this.viewId = viewId;
|
this.viewId = viewId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ export interface IProjectStore {
|
|||||||
currentProjectDetails: IProject | undefined;
|
currentProjectDetails: IProject | undefined;
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
setProjectId: (projectId: string) => void;
|
setProjectId: (projectId: string | null) => void;
|
||||||
setSearchQuery: (query: string) => void;
|
setSearchQuery: (query: string) => void;
|
||||||
|
|
||||||
getProjectById: (workspaceSlug: string, projectId: string) => IProject | null;
|
getProjectById: (workspaceSlug: string, projectId: string) => IProject | null;
|
||||||
@ -251,8 +251,8 @@ export class ProjectStore implements IProjectStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
setProjectId = (projectId: string) => {
|
setProjectId = (projectId: string | null) => {
|
||||||
this.projectId = projectId ?? null;
|
this.projectId = projectId;
|
||||||
};
|
};
|
||||||
|
|
||||||
setSearchQuery = (query: string) => {
|
setSearchQuery = (query: string) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user