Skip to content

Commit

Permalink
fix: workspace draft issues count (#5809)
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolsinghbhatia authored Oct 11, 2024
1 parent 7e33420 commit 286ab7f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions web/core/store/issue/workspace-draft/issue.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ export class WorkspaceDraftIssues implements IWorkspaceDraftIssues {
runInAction(() => {
this.addIssue([response]);
update(this.issueMapIds, [workspaceSlug], (existingIssueIds = []) => [response.id, ...existingIssueIds]);
// increase the count of issues in the pagination info
if (this.paginationInfo?.total_count) {
set(this, "paginationInfo", {
...this.paginationInfo,
total_count: this.paginationInfo.total_count + 1,
});
}
});
}

Expand Down Expand Up @@ -294,6 +301,13 @@ export class WorkspaceDraftIssues implements IWorkspaceDraftIssues {
runInAction(() => {
unset(this.issueMapIds[workspaceSlug], issueId);
unset(this.issuesMap, issueId);
// reduce the count of issues in the pagination info
if (this.paginationInfo?.total_count) {
set(this, "paginationInfo", {
...this.paginationInfo,
total_count: this.paginationInfo.total_count - 1,
});
}
});

this.loader = undefined;
Expand All @@ -312,6 +326,13 @@ export class WorkspaceDraftIssues implements IWorkspaceDraftIssues {
runInAction(() => {
unset(this.issueMapIds[workspaceSlug], issueId);
unset(this.issuesMap, issueId);
// reduce the count of issues in the pagination info
if (this.paginationInfo?.total_count) {
set(this, "paginationInfo", {
...this.paginationInfo,
total_count: this.paginationInfo.total_count - 1,
});
}
});

this.loader = undefined;
Expand Down

0 comments on commit 286ab7f

Please sign in to comment.