Skip to content

Commit

Permalink
fix(vscode): fix preventing multiple panel issues (webview is disposed)
Browse files Browse the repository at this point in the history
  • Loading branch information
ytaek committed Oct 5, 2023
1 parent f333df5 commit 9d1bda3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 9d1bda3

Please sign in to comment.