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.

fix: delete action mutation (#5315)

Anmol Singh Bhatia3f9523804b76
diff --git a/web/core/store/cycle.store.ts b/web/core/store/cycle.store.ts
index d8ef84cf68..2845527c23 100644
--- a/web/core/store/cycle.store.ts
+++ b/web/core/store/cycle.store.ts
@@ -551,9 +551,9 @@ export class CycleStore implements ICycleStore {
deleteCycle = async (workspaceSlug: string, projectId: string, cycleId: string) =>
await this.cycleService.deleteCycle(workspaceSlug, projectId, cycleId).then(() => {
runInAction(() => {
- this.rootStore.favorite.removeFavoriteFromStore(cycleId);
delete this.cycleMap[cycleId];
delete this.activeCycleIdMap[cycleId];
+ if (this.rootStore.favorite.entityMap[cycleId]) this.rootStore.favorite.removeFavoriteFromStore(cycleId);
});
});
diff --git a/web/core/store/module.store.ts b/web/core/store/module.store.ts
index e5631eedfa..23e5cb0127 100644
--- a/web/core/store/module.store.ts
+++ b/web/core/store/module.store.ts
@@ -405,7 +405,7 @@ export class ModulesStore implements IModuleStore {
await this.moduleService.deleteModule(workspaceSlug, projectId, moduleId).then(() => {
runInAction(() => {
delete this.moduleMap[moduleId];
- this.rootStore.favorite.removeFavoriteFromStore(moduleId);
+ if (this.rootStore.favorite.entityMap[moduleId]) this.rootStore.favorite.removeFavoriteFromStore(moduleId);
});
});
};
diff --git a/web/core/store/pages/project-page.store.ts b/web/core/store/pages/project-page.store.ts
index 18487d3b3b..0629cc17be 100644
--- a/web/core/store/pages/project-page.store.ts
+++ b/web/core/store/pages/project-page.store.ts
@@ -261,7 +261,7 @@ export class ProjectPageStore implements IProjectPageStore {
await this.service.remove(workspaceSlug, projectId, pageId);
runInAction(() => {
unset(this.data, [pageId]);
- this.rootStore.favorite.removeFavoriteFromStore(pageId);
+ if (this.rootStore.favorite.entityMap[pageId]) this.rootStore.favorite.removeFavoriteFromStore(pageId);
});
} catch (error) {
runInAction(() => {
diff --git a/web/core/store/project-view.store.ts b/web/core/store/project-view.store.ts
index 61721cad79..b9f4e86568 100644
--- a/web/core/store/project-view.store.ts
+++ b/web/core/store/project-view.store.ts
@@ -271,7 +271,7 @@ export class ProjectViewStore implements IProjectViewStore {
await this.viewService.deleteView(workspaceSlug, projectId, viewId).then(() => {
runInAction(() => {
delete this.viewMap[viewId];
- this.rootStore.favorite.removeFavoriteFromStore(viewId);
+ if (this.rootStore.favorite.entityMap[viewId]) this.rootStore.favorite.removeFavoriteFromStore(viewId);
});
});
};
diff --git a/web/core/store/project/project.store.ts b/web/core/store/project/project.store.ts
index fe1f305661..faebabf15d 100644
--- a/web/core/store/project/project.store.ts
+++ b/web/core/store/project/project.store.ts
@@ -401,7 +401,7 @@ export class ProjectStore implements IProjectStore {
await this.projectService.deleteProject(workspaceSlug, projectId);
runInAction(() => {
delete this.projectMap[projectId];
- this.rootStore.favorite.removeFavoriteFromStore(projectId);
+ if (this.rootStore.favorite.entityMap[projectId]) this.rootStore.favorite.removeFavoriteFromStore(projectId);
});
} catch (error) {
console.log("Failed to delete project from project store");