From 980e0bfd3facf196514c26fd24921b57769ae61f Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Tue, 13 Jun 2023 15:12:55 -0400 Subject: [PATCH] Ensures settings webview state is not stale --- src/webviews/apps/settings/settings.ts | 2 ++ src/webviews/settings/settingsWebview.ts | 4 ++++ src/webviews/webviewController.ts | 1 + 3 files changed, 7 insertions(+) diff --git a/src/webviews/apps/settings/settings.ts b/src/webviews/apps/settings/settings.ts index f29008e47aa2f..f70f186b686bb 100644 --- a/src/webviews/apps/settings/settings.ts +++ b/src/webviews/apps/settings/settings.ts @@ -149,6 +149,8 @@ export class SettingsApp extends App { 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(); }); diff --git a/src/webviews/settings/settingsWebview.ts b/src/webviews/settings/settingsWebview.ts index 2fcd8de766cb0..ea7ccda03e8d2 100644 --- a/src/webviews/settings/settingsWebview.ts +++ b/src/webviews/settings/settingsWebview.ts @@ -54,6 +54,10 @@ export class SettingsWebviewProvider implements WebviewProvider { }; } + onReloaded(): void { + void this.notifyDidChangeConfiguration(); + } + onShowing?( loading: boolean, _options: { column?: ViewColumn; preserveFocus?: boolean }, diff --git a/src/webviews/webviewController.ts b/src/webviews/webviewController.ts index 564ba75a37d51..15a2a2118294f 100644 --- a/src/webviews/webviewController.ts +++ b/src/webviews/webviewController.ts @@ -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();