fix: inbox issue store update logic. (#4683)

This commit is contained in:
Prateek Shourya 2024-06-03 14:32:18 +05:30 committed by GitHub
parent a428bc16c4
commit ddfd953408
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -212,16 +212,15 @@ export class ProjectInboxStore implements IProjectInboxStore {
createOrUpdateInboxIssue = (inboxIssues: TInboxIssue[], workspaceSlug: string, projectId: string) => { createOrUpdateInboxIssue = (inboxIssues: TInboxIssue[], workspaceSlug: string, projectId: string) => {
if (inboxIssues && inboxIssues.length > 0) { if (inboxIssues && inboxIssues.length > 0) {
inboxIssues.forEach((inbox: TInboxIssue) => { inboxIssues.forEach((inbox: TInboxIssue) => {
const inboxIssueDetail = this.getIssueInboxByIssueId(inbox?.issue?.id); const existingInboxIssueDetail = this.getIssueInboxByIssueId(inbox?.issue?.id);
if (inboxIssueDetail) if (existingInboxIssueDetail)
update(this.inboxIssues, [inbox?.issue?.id], (existingInboxIssue) => ({ Object.assign(existingInboxIssueDetail, {
...existingInboxIssue,
...inbox, ...inbox,
issue: { issue: {
...existingInboxIssue?.issue, ...existingInboxIssueDetail.issue,
...inbox?.issue, ...inbox.issue,
}, },
})); });
else else
set(this.inboxIssues, [inbox?.issue?.id], new InboxIssueStore(workspaceSlug, projectId, inbox, this.store)); set(this.inboxIssues, [inbox?.issue?.id], new InboxIssueStore(workspaceSlug, projectId, inbox, this.store));
}); });