Skip to content

Commit acde1bc

Browse files
committed
fix(vscode): fix preventing multiple panel issues (webview is disposed)
1 parent f333df5 commit acde1bc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/vscode/src/extension.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export async function activate(context: vscode.ExtensionContext) {
3434

3535
const disposable = vscode.commands.registerCommand(COMMAND_LAUNCH, async () => {
3636
try {
37-
console.debug("current Panel = ", currentPanel);
37+
console.debug("current Panel = ", currentPanel, currentPanel?.onDidDispose);
3838
if (currentPanel) {
3939
currentPanel.reveal();
4040
return;
@@ -97,6 +97,14 @@ export async function activate(context: vscode.ExtensionContext) {
9797
});
9898
currentPanel = webLoader.getPanel();
9999

100+
currentPanel?.onDidDispose(
101+
() => {
102+
currentPanel = undefined;
103+
},
104+
null,
105+
context.subscriptions
106+
);
107+
100108
subscriptions.push(webLoader);
101109
vscode.window.showInformationMessage("Hello Githru");
102110
} catch (error) {

0 commit comments

Comments
 (0)