diff --git a/src/dashboard-refactor/logic.ts b/src/dashboard-refactor/logic.ts index 881f5d1a5c..ead0543c1f 100644 --- a/src/dashboard-refactor/logic.ts +++ b/src/dashboard-refactor/logic.ts @@ -1576,6 +1576,21 @@ export class DashboardLogic extends UILogic { previousState, }) => { if (event.instaDelete) { + const pageLists = + previousState.searchResults.pageData.byId[event.pageId].lists + const isPageInInbox = pageLists.some( + (listId) => + this.options.annotationsCache.lists.byId[listId].localId === + SPECIAL_LIST_IDS.INBOX, + ) + + if (isPageInInbox) { + this.emitMutation({ + listsSidebar: { + inboxUnreadCount: { $apply: (count) => count - 1 }, + }, + }) + } await executeUITask( this, (taskState) => ({ @@ -1808,6 +1823,20 @@ export class DashboardLogic extends UILogic { const { pageId, day } = modals.deletingPageArgs + const pageLists = pageData.byId[pageId].lists + const isPageInInbox = pageLists.some( + (listId) => + this.options.annotationsCache.lists.byId[listId].localId === + SPECIAL_LIST_IDS.INBOX, + ) + + if (isPageInInbox) { + this.emitMutation({ + listsSidebar: { + inboxUnreadCount: { $apply: (count) => count - 1 }, + }, + }) + } await executeUITask( this, (taskState) => ({