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.

[WEB-3863] fix: handled error handling for link editing #6968

Akshita Goyald86ac368a4ce
diff --git a/web/core/store/issue/issue-details/link.store.ts b/web/core/store/issue/issue-details/link.store.ts
index 85c6fa5b83..5a0ea20e6f 100644
--- a/web/core/store/issue/issue-details/link.store.ts
+++ b/web/core/store/issue/issue-details/link.store.ts
@@ -121,17 +121,28 @@ export class IssueLinkStore implements IIssueLinkStore {
linkId: string,
data: Partial<TIssueLink>
) => {
- runInAction(() => {
- Object.keys(data).forEach((key) => {
- set(this.linkMap, [linkId, key], data[key as keyof TIssueLink]);
+ const initialData = { ...this.linkMap[linkId] };
+ try {
+ runInAction(() => {
+ Object.keys(data).forEach((key) => {
+ set(this.linkMap, [linkId, key], data[key as keyof TIssueLink]);
+ });
});
- });
- const response = await this.issueService.updateIssueLink(workspaceSlug, projectId, issueId, linkId, data);
+ const response = await this.issueService.updateIssueLink(workspaceSlug, projectId, issueId, linkId, data);
- // fetching activity
- this.rootIssueDetailStore.activity.fetchActivities(workspaceSlug, projectId, issueId);
- return response;
+ // fetching activity
+ this.rootIssueDetailStore.activity.fetchActivities(workspaceSlug, projectId, issueId);
+ return response;
+ } catch (error) {
+ console.error("error", error);
+ runInAction(() => {
+ Object.keys(initialData).forEach((key) => {
+ set(this.linkMap, [linkId, key], initialData[key as keyof TIssueLink]);
+ });
+ });
+ return initialData;
+ }
};
removeLink = async (workspaceSlug: string, projectId: string, issueId: string, linkId: string) => {