From acde1bcd2f46c6e1ac17227bb7b4c52a630e79ec Mon Sep 17 00:00:00 2001 From: "ytaek.kim" Date: Thu, 5 Oct 2023 21:19:10 +0900 Subject: [PATCH] fix(vscode): fix preventing multiple panel issues (webview is disposed) --- packages/vscode/src/extension.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/vscode/src/extension.ts b/packages/vscode/src/extension.ts index 284870bf..10e67a44 100644 --- a/packages/vscode/src/extension.ts +++ b/packages/vscode/src/extension.ts @@ -34,7 +34,7 @@ export async function activate(context: vscode.ExtensionContext) { const disposable = vscode.commands.registerCommand(COMMAND_LAUNCH, async () => { try { - console.debug("current Panel = ", currentPanel); + console.debug("current Panel = ", currentPanel, currentPanel?.onDidDispose); if (currentPanel) { currentPanel.reveal(); return; @@ -97,6 +97,14 @@ export async function activate(context: vscode.ExtensionContext) { }); currentPanel = webLoader.getPanel(); + currentPanel?.onDidDispose( + () => { + currentPanel = undefined; + }, + null, + context.subscriptions + ); + subscriptions.push(webLoader); vscode.window.showInformationMessage("Hello Githru"); } catch (error) {