From f012ced0cc9bfa8dfa0b99527cb8bd88d0d34f09 Mon Sep 17 00:00:00 2001 From: Bernd Hufmann Date: Tue, 26 Mar 2024 17:20:02 -0400 Subject: [PATCH] Refresh trace viewer after server URL preference changes For the case that with current URL the welcome view is rendered due to noExperiment or server is down, this will render the trace explorer (or welcome view) after a server URL change. Without calling refresh, the welcome view stays, even if the other server has experiments. Fixes #229 Signed-off-by: Bernd Hufmann --- vscode-trace-common/src/client/tsp-client-provider-impl.ts | 7 ++++--- vscode-trace-extension/src/extension.ts | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/vscode-trace-common/src/client/tsp-client-provider-impl.ts b/vscode-trace-common/src/client/tsp-client-provider-impl.ts index 9c0f837..04105a8 100644 --- a/vscode-trace-common/src/client/tsp-client-provider-impl.ts +++ b/vscode-trace-common/src/client/tsp-client-provider-impl.ts @@ -20,11 +20,12 @@ export class TspClientProvider implements ITspClientProvider { RestClient.addConnectionStatusListener(status => { // Ignore the first update that is sent when calling addConnectionStatusListener - if (this._initialized) { - this._signalHandler?.notifyConnection(status); + if (!this._initialized) { + this._initialized = true; + return; } + this._signalHandler?.notifyConnection(status); }); - this._initialized = true; this._tspClient.checkHealth(); // When this is called in the remote use-case, it will block the port-forwarding service-worker. } diff --git a/vscode-trace-extension/src/extension.ts b/vscode-trace-extension/src/extension.ts index 6b93491..c059871 100644 --- a/vscode-trace-extension/src/extension.ts +++ b/vscode-trace-extension/src/extension.ts @@ -106,6 +106,9 @@ export function activate(context: vscode.ExtensionContext): ExternalAPI { // Signal the change to all trace panels TraceViewerPanel.updateTraceServerUrl(newTspClientURL); + + // Refresh so that either trace explorer or welcome page is rendered + vscode.commands.executeCommand('trace-explorer.refreshContext'); } }) );