diff --git a/src/sql/workbench/services/objectExplorer/browser/serverTreeActionProvider.ts b/src/sql/workbench/services/objectExplorer/browser/serverTreeActionProvider.ts index 73bf12b48b..869ff1919d 100644 --- a/src/sql/workbench/services/objectExplorer/browser/serverTreeActionProvider.ts +++ b/src/sql/workbench/services/objectExplorer/browser/serverTreeActionProvider.ts @@ -126,14 +126,15 @@ export class ServerTreeActionProvider { private getBuiltinConnectionActions(context: ObjectExplorerContext): IAction[] { let actions: IAction[] = []; - if (this._connectionManagementService.isProfileConnected(context.profile)) { + const isProfileConnected = this._connectionManagementService.isProfileConnected(context.profile); + if (isProfileConnected) { actions.push(this._instantiationService.createInstance(DisconnectConnectionAction, DisconnectConnectionAction.ID, DisconnectConnectionAction.LABEL, context.profile)); } actions.push(this._instantiationService.createInstance(EditConnectionAction, EditConnectionAction.ID, EditConnectionAction.LABEL, context.profile)); actions.push(this._instantiationService.createInstance(DeleteConnectionAction, DeleteConnectionAction.ID, DeleteConnectionAction.DELETE_CONNECTION_LABEL, context.profile)); // Contribute refresh action for scriptable objects via contribution - if (!this.isScriptableObject(context)) { + if (isProfileConnected && !this.isScriptableObject(context)) { actions.push(this._instantiationService.createInstance(RefreshAction, RefreshAction.ID, RefreshAction.LABEL, context.tree, context.profile)); } return actions;