[WEB-2896] fix: mutation problem with issue properties while accepting an intake issue. (#6277)

This commit is contained in:
Prateek Shourya
2024-12-26 16:46:52 +05:30
committed by GitHub
parent ed64168ca7
commit a5c1282e52
2 changed files with 6 additions and 3 deletions

View File

@@ -64,9 +64,10 @@ export const updatePersistentLayer = async (issueIds: string | string[]) => {
issueIds.forEach(async (issueId) => {
const dbIssue = await persistence.getIssue(issueId);
const issue = rootStore.issue.issues.getIssueById(issueId);
const updatedIssue = dbIssue ? { ...dbIssue, ...issue } : issue;
if (issue) {
addIssueToPersistanceLayer(issue);
if (updatedIssue) {
addIssueToPersistanceLayer(updatedIssue);
}
});
};

View File

@@ -98,7 +98,9 @@ export class InboxIssueStore implements IInboxIssueStore {
// If issue accepted sync issue to local db
if (status === EInboxIssueStatus.ACCEPTED) {
addIssueToPersistanceLayer({ ...this.issue, ...inboxIssue.issue });
const updatedIssue = { ...this.issue, ...inboxIssue.issue };
this.store.issue.issues.addIssue([updatedIssue]);
await addIssueToPersistanceLayer(updatedIssue);
}
} catch {
runInAction(() => set(this, "status", previousData.status));