Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions web/core/components/cycles/delete-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const CycleDeleteModal: React.FC<ICycleDelete> = observer((props) => {
try {
await deleteCycle(workspaceSlug, projectId, cycle.id)
.then(() => {
if (cycleId || peekCycle) router.push(`/${workspaceSlug}/projects/${projectId}/cycles`);
setToast({
type: TOAST_TYPE.SUCCESS,
title: "Success!",
Expand All @@ -68,8 +69,6 @@ export const CycleDeleteModal: React.FC<ICycleDelete> = observer((props) => {
});
})
.finally(() => handleClose());

if (cycleId || peekCycle) router.push(`/${workspaceSlug}/projects/${projectId}/cycles`);
} catch (error) {
setToast({
type: TOAST_TYPE.ERROR,
Expand Down
2 changes: 1 addition & 1 deletion web/core/components/inbox/content/inbox-issue-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p

const handleInboxIssueDelete = async () => {
if (!inboxIssue || !currentInboxIssueId) return;
await deleteInboxIssue(workspaceSlug, projectId, currentInboxIssueId).finally(() => {
await deleteInboxIssue(workspaceSlug, projectId, currentInboxIssueId).then(() => {
if (!isNotificationEmbed) router.push(`/${workspaceSlug}/projects/${projectId}/inbox`);
});
};
Expand Down
30 changes: 14 additions & 16 deletions web/core/store/inbox/project-inbox.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,25 +484,23 @@ export class ProjectInboxStore implements IProjectInboxStore {
const currentIssue = this.inboxIssues?.[inboxIssueId];
try {
if (!currentIssue) return;
runInAction(() => {
set(
this,
["inboxIssuePaginationInfo", "total_results"],
(this.inboxIssuePaginationInfo?.total_results || 0) - 1
);
set(this, "inboxIssues", omit(this.inboxIssues, inboxIssueId));
set(
this,
["inboxIssueIds"],
this.inboxIssueIds.filter((id) => id !== inboxIssueId)
);
await this.inboxIssueService.destroy(workspaceSlug, projectId, inboxIssueId).then(() => {
runInAction(() => {
set(
this,
["inboxIssuePaginationInfo", "total_results"],
(this.inboxIssuePaginationInfo?.total_results || 0) - 1
);
set(this, "inboxIssues", omit(this.inboxIssues, inboxIssueId));
set(
this,
["inboxIssueIds"],
this.inboxIssueIds.filter((id) => id !== inboxIssueId)
);
});
});
await this.inboxIssueService.destroy(workspaceSlug, projectId, inboxIssueId);
} catch (error) {
console.error("Error removing the intake issue");
set(this.inboxIssues, [inboxIssueId], currentIssue);
set(this, ["inboxIssuePaginationInfo", "total_results"], (this.inboxIssuePaginationInfo?.total_results || 0) + 1);
set(this, ["inboxIssueIds"], [...this.inboxIssueIds, inboxIssueId]);
throw error;
}
};
Expand Down