Skip to content

Commit cfcc8a8

Browse files
committed
Fix: multi-panel
1 parent 1bd52c9 commit cfcc8a8

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

src/commands/showPanel.tsx

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,17 @@ export async function showPanel(
3636
// Get a reference to the active editor (before the focus is switched to our newly created webview)
3737
// firstEditor = vscode.window.activeTextEditor!;
3838

39-
messageHandler.panel = vscode.window.createWebviewPanel(
40-
"source-academy-panel",
41-
"Source Academy",
42-
vscode.ViewColumn.Beside,
43-
{
44-
enableScripts: true, // Enable scripts in the webview
45-
retainContextWhenHidden: true,
46-
},
47-
);
48-
49-
// Reset stored panel when the user closes it
50-
messageHandler.panel.onDidDispose(() => {
51-
messageHandler.panel = null;
52-
});
53-
5439
messageHandler.panel.webview.onDidReceiveMessage(
5540
(message: MessageType) => messageHandler.handleMessage(context, message),
5641
undefined,
5742
context.subscriptions,
5843
);
5944

45+
messageHandler.panel.onDidDispose(() => {
46+
console.log("Panel disposed, clearing message handler panel");
47+
messageHandler.panel = null;
48+
});
49+
6050
const iframeUrl = new URL(route ?? "/playground", config.frontendBaseUrl)
6151
.href;
6252

0 commit comments

Comments
 (0)