Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extra inbox tabs #7543

Merged
merged 1 commit into from
Dec 25, 2024
Merged
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
10 changes: 6 additions & 4 deletions plugins/workbench-resources/src/workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,13 @@ let prevTabId: Ref<WorkbenchTab> | 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<void> => {
const loc = getCurrentLocation()
const workspace = get(locationWorkspaceStore)
Expand All @@ -84,11 +83,14 @@ const syncTabLoc = reduceCalls(async (): Promise<void> => {
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
Expand Down Expand Up @@ -127,7 +129,7 @@ const syncTabLoc = reduceCalls(async (): Promise<void> => {
}
})

locationStore.subscribe((l: Location) => {
locationStore.subscribe(() => {
void syncTabLoc()
})

Expand Down
Loading