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: issue link count mutation (#5006)

Anmol Singh Bhatiaa5628c4ce1ec
diff --git a/web/core/store/issue/issue-details/link.store.ts b/web/core/store/issue/issue-details/link.store.ts
index b6606ef318..3a22655804 100644
--- a/web/core/store/issue/issue-details/link.store.ts
+++ b/web/core/store/issue/issue-details/link.store.ts
@@ -104,10 +104,13 @@ export class IssueLinkStore implements IIssueLinkStore {
createLink = async (workspaceSlug: string, projectId: string, issueId: string, data: Partial<TIssueLink>) => {
try {
const response = await this.issueService.createIssueLink(workspaceSlug, projectId, issueId, data);
-
+ const issueLinkCount = this.getLinksByIssueId(issueId)?.length ?? 0;
runInAction(() => {
this.links[issueId].push(response.id);
set(this.linkMap, response.id, response);
+ this.rootIssueDetailStore.rootIssueStore.issues.updateIssue(issueId, {
+ link_count: issueLinkCount + 1, // increment link count
+ });
});
// fetching activity
@@ -145,6 +148,7 @@ export class IssueLinkStore implements IIssueLinkStore {
removeLink = async (workspaceSlug: string, projectId: string, issueId: string, linkId: string) => {
try {
+ const issueLinkCount = this.getLinksByIssueId(issueId)?.length ?? 0;
await this.issueService.deleteIssueLink(workspaceSlug, projectId, issueId, linkId);
const linkIndex = this.links[issueId].findIndex((_comment) => _comment === linkId);
@@ -152,6 +156,9 @@ export class IssueLinkStore implements IIssueLinkStore {
runInAction(() => {
this.links[issueId].splice(linkIndex, 1);
delete this.linkMap[linkId];
+ this.rootIssueDetailStore.rootIssueStore.issues.updateIssue(issueId, {
+ link_count: issueLinkCount - 1, // decrement link count
+ });
});
// fetching activity