Skip to content

Commit 12c24f1

Browse files
committed
fix: snapshots: check if sidebar is open before throwing tabs to it
1 parent 9d46d95 commit 12c24f1

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/page.setup/components/snapshots.tab.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,10 @@ function onTabDragStart(e: DragEvent): void {
144144
}
145145
146146
async function openTab(tab: SnapTabState): Promise<void> {
147-
let activePanel
148-
try {
149-
activePanel = await IPC.sidebar(Windows.id, 'getActivePanelConfig')
150-
} catch (err) {
151-
Logs.err('snapshots.tab.openTab: Unable to getActivePanelConfig:', err)
152-
}
147+
const activePanel = await browser.sidebarAction
148+
.isOpen({ windowId: Windows.id })
149+
.then(isOpen => (isOpen ? IPC.sidebar(Windows.id, 'getActivePanelConfig') : undefined))
150+
.catch(() => undefined)
153151
154152
if (activePanel) {
155153
const item: ItemInfo = {

src/page.setup/components/snapshots.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,10 @@ async function openSelectedTabs(how: SnapOpenType): Promise<void> {
281281
}
282282
283283
if (how === SnapOpenType.CurrentPanel) {
284-
const activePanel = await IPC.sidebar(Windows.id, 'getActivePanelConfig').catch(() => undefined)
284+
const activePanel = await browser.sidebarAction
285+
.isOpen({ windowId: Windows.id })
286+
.then(isOpen => (isOpen ? IPC.sidebar(Windows.id, 'getActivePanelConfig') : undefined))
287+
.catch(() => undefined)
285288
if (Utils.isTabsPanel(activePanel)) {
286289
await IPC.sidebar(Windows.id, 'openTabs', items, { panelId: activePanel.id })
287290
} else if (activePanel) {

0 commit comments

Comments
 (0)