mirror of
https://github.com/makeplane/plane
synced 2025-08-07 19:59:33 +00:00
fix: issue link count mutation (#5006)
This commit is contained in:
committed by
GitHub
parent
764e08140c
commit
a5628c4ce1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user