Skip to content

Commit

Permalink
Ensures settings webview state is not stale
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio authored and pull[bot] committed Aug 27, 2024
1 parent c2172ed commit 980e0bf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/webviews/apps/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ export class SettingsApp extends App<State> {
onIpc(DidChangeConfigurationNotificationType, msg, params => {
this.state.config = params.config;
this.state.customSettings = params.customSettings;
this.state.timestamp = Date.now();
this.setState(this.state);

this.updateState();
});
Expand Down
4 changes: 4 additions & 0 deletions src/webviews/settings/settingsWebview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export class SettingsWebviewProvider implements WebviewProvider<State> {
};
}

onReloaded(): void {
void this.notifyDidChangeConfiguration();
}

onShowing?(
loading: boolean,
_options: { column?: ViewColumn; preserveFocus?: boolean },
Expand Down
1 change: 1 addition & 0 deletions src/webviews/webviewController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ export class WebviewController<
if (this._ready) {
this.sendPendingIpcNotifications();
} else if (this.provider.onReloaded != null) {
this.clearPendingIpcNotifications();
this.provider.onReloaded();
} else {
void this.refresh();
Expand Down

0 comments on commit 980e0bf

Please sign in to comment.