Compare commits

...

5 Commits

Author SHA1 Message Date
vamsikrishnamathala 40609f0d41 Merge branch 'fix-sub_issues_deletion' of github.com:makeplane/plane into fix-sub_issues_deletion 2025-08-19 17:23:33 +05:30
vamsikrishnamathala a7e0f7a90a draft: sub issue deletion 2025-08-19 17:23:05 +05:30
sriramveeraghanta 184365f2ea Merge branch 'preview' of github.com:makeplane/plane into fix-sub_issues_deletion 2025-08-18 21:28:52 +05:30
vamsikrishnamathala 5c4c87c1dc fix: added recursive remote 2025-08-18 16:41:38 +05:30
vamsikrishnamathala 2e8caeaca2 fix: sub issues deletion is parent mode 2025-08-18 15:18:23 +05:30
2 changed files with 25 additions and 9 deletions
@@ -561,7 +561,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
this.addIssue(response, shouldUpdateList);
// If shouldUpdateList is true, call fetchParentStats
shouldUpdateList && (await this.fetchParentStats(workspaceSlug, projectId));
if (shouldUpdateList) await this.fetchParentStats(workspaceSlug, projectId);
updatePersistentLayer(response.id);
@@ -675,6 +675,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
// Male API call
await this.issueService.deleteIssue(workspaceSlug, projectId, issueId);
// Remove from Respective issue Id list
runInAction(() => {
this.removeIssueFromList(issueId);
@@ -682,7 +683,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
// call fetch Parent stats
this.fetchParentStats(workspaceSlug, projectId);
// Remove issue from main issue Map store
this.rootIssueStore.issues.removeIssue(issueId);
this.removeIssuesRecursively(issueId);
}
/**
@@ -757,7 +758,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
runInAction(() => {
issueIds.forEach((issueId) => {
this.removeIssueFromList(issueId);
this.rootIssueStore.issues.removeIssue(issueId);
this.removeIssuesRecursively(issueId);
});
});
return response;
@@ -932,7 +933,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
runInAction(() => {
// If cycle Id is the current cycle Id, then, remove issue from list of issueIds
this.cycleId === cycleId && this.removeIssueFromList(issueId);
if (this.cycleId === cycleId) this.removeIssueFromList(issueId);
});
// update Issue cycle Id to null by calling current store's update Issue, without making an API call
@@ -1062,7 +1063,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
runInAction(() => {
// if module Id is the current Module Id, then, add issue to list of issueIds
this.moduleId === moduleId && issueIds.forEach((issueId) => this.addIssueToList(issueId));
if (this.moduleId === moduleId) issueIds.forEach((issueId) => this.addIssueToList(issueId));
});
// For Each issue update module Ids by calling current store's update Issue, without making an API call
@@ -1090,7 +1091,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
runInAction(() => {
// if module Id is the current Module Id, then remove issue from list of issueIds
this.moduleId === moduleId && issueIds.forEach((issueId) => this.removeIssueFromList(issueId));
if (this.moduleId === moduleId) issueIds.forEach((issueId) => this.removeIssueFromList(issueId));
});
// For Each issue update module Ids by calling current store's update Issue, without making an API call
@@ -1163,7 +1164,7 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
// remove the new issue id to the module issues
removeModuleIds.forEach((moduleId) => {
// If module Id is equal to current module Id, them remove Issue from List
this.moduleId === moduleId && this.removeIssueFromList(issueId);
if (this.moduleId === moduleId) this.removeIssueFromList(issueId);
currentModuleIds = pull(currentModuleIds, moduleId);
});
@@ -1259,6 +1260,12 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
*/
removeIssueFromList(issueId: string) {
const issue = this.rootIssueStore.issues.getIssueById(issueId);
const subIssueIds = this.rootIssueStore.rootStore.issue.issueDetail.subIssues.subIssuesByIssueId(issueId);
if (subIssueIds) {
subIssueIds.forEach((subIssueId) => {
this.removeIssueFromList(subIssueId);
});
}
this.updateIssueList(undefined, issue, EIssueGroupedAction.DELETE);
}
@@ -2036,4 +2043,14 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
subGroupId
);
};
removeIssuesRecursively = (issueId: string) => {
// get sub issues by issue id
const subIssues = this.rootIssueStore.rootStore.issue.issueDetail.subIssues.subIssuesByIssueId(issueId);
if (subIssues) {
subIssues.forEach((subIssueId) => this.removeIssuesRecursively(subIssueId));
}
// remove issue
this.rootIssueStore.issues.removeIssue(issueId);
};
}
+1 -2
View File
@@ -124,9 +124,8 @@ export class IssueStore implements IIssueStore {
* @returns {void}
*/
removeIssue = (issueId: string) => {
if (!issueId || !this.issuesMap[issueId]) return;
runInAction(() => {
delete this.issuesMap[issueId];
if (this.issuesMap[issueId]) delete this.issuesMap[issueId];
});
deleteIssueFromLocal(issueId);
};