Skip to content

Commit

Permalink
Merge pull request #2460 from posit-dev/mnv-fix-last-deploy-init
Browse files Browse the repository at this point in the history
Fix loading last selected deployment
  • Loading branch information
marcosnav authored Dec 10, 2024
2 parents e60e7f3 + ca9c5ae commit 9aa66fd
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions extensions/vscode/src/views/homeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,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();
Expand Down Expand Up @@ -384,8 +386,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);
Expand Down Expand Up @@ -1405,15 +1411,17 @@ 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;
this.updateWebViewViewCredentials();
this.updateWebViewViewConfigurations();
this.updateWebViewViewContentRecords(selectionState || null);
if (includeSavedState && selectionState) {
this.refreshActiveContentRecord();
this.refreshActiveConfig();
this.refreshActiveContentRecord(selectedContentRecord);
this.refreshActiveConfig(selectedConfig);
}
};

Expand Down

0 comments on commit 9aa66fd

Please sign in to comment.