Skip to content

Commit 81881d5

Browse files
refactor: use existing functions in togglePanel
1 parent f027d09 commit 81881d5

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/core/ExtensionManager.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,13 @@ class ExtensionManager {
7474

7575
async togglePanel(panelType) {
7676
try {
77-
const existingPanelInDOM = this.panels.get(panelType);
77+
const panel = this.panels.get(panelType);
7878

79-
if (existingPanelInDOM && existingPanelInDOM.isVisible) {
80-
// Panel exists and is visible -> hide it
81-
await existingPanelInDOM.hide();
82-
} else if (existingPanelInDOM && !existingPanelInDOM.isVisible) {
83-
// Panel exists but hidden -> ensure it's initialized and show it
84-
if (!existingPanelInDOM.container || !existingPanelInDOM.container.parentNode) {
85-
// Re-initialize if container is missing or not in DOM
86-
await existingPanelInDOM.initialize();
87-
}
88-
await existingPanelInDOM.show();
79+
if (panel && panel.isVisible) {
80+
// Panel is visible -> close it
81+
this.closePanel(panelType);
8982
} else {
90-
// Panel doesn't exist -> create and open it
83+
// Panel doesn't exist or is hidden -> open it
9184
await this.openPanel(panelType);
9285
}
9386
}

0 commit comments

Comments
 (0)