Merge pull request #1818 from github/koesie10/fix-duplicate-webviews-error

Close serialized webview when another view already exists
This commit is contained in:
Koen Vlaswinkel
2022-12-01 12:55:47 +01:00
committed by GitHub
2 changed files with 10 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ export interface VariantAnalysisViewManager<
> {
registerView(view: T): void;
unregisterView(view: T): void;
getView(variantAnalysisId: number): T | undefined;
getVariantAnalysis(
variantAnalysisId: number,

View File

@@ -38,6 +38,15 @@ export class VariantAnalysisViewSerializer implements WebviewPanelSerializer {
const manager = await this.waitForExtensionFullyLoaded();
const existingView = manager.getView(
variantAnalysisState.variantAnalysisId,
);
if (existingView) {
await existingView.openView();
webviewPanel.dispose();
return;
}
const view = new VariantAnalysisView(
this.ctx,
variantAnalysisState.variantAnalysisId,