From fa4dc0dcbed90d14315969a1fee4c6916f8adb35 Mon Sep 17 00:00:00 2001 From: Kristina Date: Wed, 25 Dec 2024 04:57:14 +0400 Subject: [PATCH] Fix extra inbox tabs (#7543) --- plugins/workbench-resources/src/workbench.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/workbench-resources/src/workbench.ts b/plugins/workbench-resources/src/workbench.ts index c5e1eaba60..2852cfc5db 100644 --- a/plugins/workbench-resources/src/workbench.ts +++ b/plugins/workbench-resources/src/workbench.ts @@ -54,14 +54,13 @@ let prevTabId: Ref | undefined tabIdStore.subscribe((value) => { prevTabIdStore.set(prevTabId) prevTabId = value + saveTabToLocalStorage(value) }) locationWorkspaceStore.subscribe((workspace) => { tabIdStore.set(getTabFromLocalStorage(workspace ?? '')) }) -tabIdStore.subscribe(saveTabToLocalStorage) - const syncTabLoc = reduceCalls(async (): Promise => { const loc = getCurrentLocation() const workspace = get(locationWorkspaceStore) @@ -84,11 +83,14 @@ const syncTabLoc = reduceCalls(async (): Promise => { if (t.name !== name) return false const tabLoc = getTabLocation(t) + if (tabLoc.path[2] !== loc.path[2]) return false + if (tabLoc.path[2] === notificationId) return true - return tabLoc.path[2] === loc.path[2] && tabLoc.path[3] === loc.path[3] + return tabLoc.path[3] === loc.path[3] }) if (tab.name !== undefined && name !== tab.name && tab.isPinned) { + if (get(tabIdStore) !== tab._id) return if (tabByName !== undefined) { selectTab(tabByName._id) return @@ -127,7 +129,7 @@ const syncTabLoc = reduceCalls(async (): Promise => { } }) -locationStore.subscribe((l: Location) => { +locationStore.subscribe(() => { void syncTabLoc() })