Fix/inbox issue bugs (#3477)

* fix: inbox pending_issue_count updation from the store

* fix: inbox list item overflow issue on issue title

* fix: inbox issue mutation

---------

Co-authored-by: gurusainath <gurusainath007@gmail.com>
This commit is contained in:
Prateek Shourya 2024-01-25 19:20:02 +05:30 committed by GitHub
parent ebc891b985
commit e78c1f2060
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 3 deletions

View File

@ -65,7 +65,7 @@ export const InboxIssueListItem: FC<TInboxIssueListItem> = observer((props) => {
} ${inboxIssueDetail.status !== -2 ? "opacity-60" : ""}`}
>
<div className="flex items-center justify-between gap-x-2">
<div className="flex items-center gap-x-2">
<div className="relative flex items-center gap-x-2 overflow-hidden">
<p className="flex-shrink-0 text-xs text-custom-text-200">
{getProjectById(issue.project_id)?.identifier}-{issue.sequence_id}
</p>

View File

@ -152,7 +152,7 @@ export class InboxIssue implements IInboxIssue {
runInAction(() => {
const { ["issue_inbox"]: issueInboxDetail, ...issue } = response;
this.rootStore.inbox.rootStore.issue.issues.addIssue([issue]);
this.rootStore.inbox.rootStore.issue.issues.updateIssue(issue.id, issue);
const { ["id"]: omittedId, ...inboxIssue } = issueInboxDetail[0];
set(this.inboxIssueMap, [inboxId, response.id], inboxIssue);
});
@ -186,6 +186,7 @@ export class InboxIssue implements IInboxIssue {
this.rootStore.inbox.rootStore.issue.issues.addIssue([issue]);
const { ["id"]: omittedId, ...inboxIssue } = issueInboxDetail[0];
set(this.inboxIssueMap, [inboxId, response.id], inboxIssue);
update(this.rootStore.inbox.inbox.inboxMap, [inboxId, "pending_issue_count"], (count: number = 0) => count + 1);
});
runInAction(() => {
@ -216,7 +217,7 @@ export class InboxIssue implements IInboxIssue {
runInAction(() => {
const { ["issue_inbox"]: issueInboxDetail, ...issue } = response;
this.rootStore.inbox.rootStore.issue.issues.addIssue([issue]);
this.rootStore.inbox.rootStore.issue.issues.updateIssue(issue.id, issue);
const { ["id"]: omittedId, ...inboxIssue } = issueInboxDetail[0];
set(this.inboxIssueMap, [inboxId, response.id], inboxIssue);
});
@ -242,6 +243,8 @@ export class InboxIssue implements IInboxIssue {
runInAction(() => {
pull(this.inboxIssues[inboxId], inboxIssueId);
delete this.inboxIssueMap[inboxId][inboxIssueId];
this.rootStore.inbox.rootStore.issue.issues.removeIssue(inboxIssueId);
update(this.rootStore.inbox.inbox.inboxMap, [inboxId, "pending_issue_count"], (count: number = 0) => count - 1);
});
await this.rootStore.issue.issueDetail.fetchActivities(workspaceSlug, projectId, inboxIssueId);
@ -267,11 +270,15 @@ export class InboxIssue implements IInboxIssue {
data
);
const pendingStatus = -2;
runInAction(() => {
const { ["issue_inbox"]: issueInboxDetail, ...issue } = response;
this.rootStore.inbox.rootStore.issue.issues.addIssue([issue]);
const { ["id"]: omittedId, ...inboxIssue } = issueInboxDetail[0];
set(this.inboxIssueMap, [inboxId, response.id], inboxIssue);
update(this.rootStore.inbox.inbox.inboxMap, [inboxId, "pending_issue_count"], (count: number = 0) =>
data.status === pendingStatus ? count + 1 : count - 1
);
});
runInAction(() => {