From ca9c5ae5a2b3dd479d2a6ca2add16ce237f26c8e Mon Sep 17 00:00:00 2001 From: Marcos Navarro Date: Tue, 3 Dec 2024 18:03:21 +0900 Subject: [PATCH] Fix loading last selected deployment --- extensions/vscode/src/views/homeView.ts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/extensions/vscode/src/views/homeView.ts b/extensions/vscode/src/views/homeView.ts index 5f4351b8a..0af5a8edf 100644 --- a/extensions/vscode/src/views/homeView.ts +++ b/extensions/vscode/src/views/homeView.ts @@ -335,8 +335,10 @@ export class HomeViewProvider implements WebviewViewProvider, Disposable { return this.updateWebViewViewCredentials(); } - private async refreshActiveConfig() { - const cfg = await this.state.getSelectedConfiguration(); + private async refreshActiveConfig(cfg?: Configuration | ConfigurationError) { + if (!cfg) { + cfg = await this.state.getSelectedConfiguration(); + } this.sendRefreshedFilesLists(); this.updateServerEnvironment(); @@ -381,8 +383,12 @@ export class HomeViewProvider implements WebviewViewProvider, Disposable { ); } - private async refreshActiveContentRecord() { - const contentRecord = await this.state.getSelectedContentRecord(); + private async refreshActiveContentRecord( + contentRecord?: ContentRecord | PreContentRecord, + ) { + if (!contentRecord) { + contentRecord = await this.state.getSelectedContentRecord(); + } this.contentRecordWatchers?.dispose(); this.contentRecordWatchers = new ContentRecordWatcherManager(contentRecord); @@ -1399,6 +1405,8 @@ export class HomeViewProvider implements WebviewViewProvider, Disposable { return; } + const selectedContentRecord = await this.state.getSelectedContentRecord(); + const selectedConfig = await this.state.getSelectedConfiguration(); const selectionState = includeSavedState ? this.state.getSelection() : undefined; @@ -1406,8 +1414,8 @@ export class HomeViewProvider implements WebviewViewProvider, Disposable { this.updateWebViewViewConfigurations(); this.updateWebViewViewContentRecords(selectionState || null); if (includeSavedState && selectionState) { - this.refreshActiveContentRecord(); - this.refreshActiveConfig(); + this.refreshActiveContentRecord(selectedContentRecord); + this.refreshActiveConfig(selectedConfig); } };