Split isTheMostRecentlyActivePanel into two methods

This commit is contained in:
Robert
2023-08-15 15:14:15 +01:00
parent 552baa5570
commit 3764a7e567

View File

@@ -99,7 +99,8 @@ export class DataExtensionsEditorView extends AbstractWebview<
panel.reveal(undefined, true);
panel.onDidChangeViewState(async () => {
if (await this.isTheMostRecentlyActivePanel()) {
if (panel.active) {
await this.onPanelBecameActive();
await this.updateModelDetailsPanelState(
this.externalApiUsages,
this.databaseItem,
@@ -110,15 +111,14 @@ export class DataExtensionsEditorView extends AbstractWebview<
await this.waitForPanelLoaded();
}
private async onPanelBecameActive(): Promise<void> {
const panel = await this.getPanel();
DataExtensionsEditorView.mostRecentlyActivePanel = panel;
}
private async isTheMostRecentlyActivePanel(): Promise<boolean> {
const panel = await this.getPanel();
if (panel.active) {
DataExtensionsEditorView.mostRecentlyActivePanel = panel;
return true;
} else {
return panel === DataExtensionsEditorView.mostRecentlyActivePanel;
}
return panel === DataExtensionsEditorView.mostRecentlyActivePanel;
}
protected async getPanelConfig(): Promise<WebviewPanelConfig> {