From f605a3c6445c1d1a219d81502d386f52b1f5ac1e Mon Sep 17 00:00:00 2001 From: Aasim Khan Date: Mon, 8 May 2023 10:13:53 -0700 Subject: [PATCH] Fixing node retention after disconnect (#23020) --- .../contrib/objectExplorer/browser/serverTreeView.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/sql/workbench/contrib/objectExplorer/browser/serverTreeView.ts b/src/sql/workbench/contrib/objectExplorer/browser/serverTreeView.ts index e746a1ab57..962d51e812 100644 --- a/src/sql/workbench/contrib/objectExplorer/browser/serverTreeView.ts +++ b/src/sql/workbench/contrib/objectExplorer/browser/serverTreeView.ts @@ -336,7 +336,10 @@ export class ServerTreeView extends Disposable implements IServerTreeView { } if (newParent) { newParent.addOrReplaceConnection(movedConnection); + await this._tree.rerender(newParent); + await this._tree.makeElementDirty(newParent); await this._tree.updateChildren(newParent); + await this._tree.expand(newParent); } const newConnection = this._tree.getElementById(movedConnection.id); if (newConnection) { @@ -516,14 +519,14 @@ export class ServerTreeView extends Disposable implements IServerTreeView { } // Delete the node from the tree await this._objectExplorerService.deleteObjectExplorerNode(connectionProfile); - // Collapse the node - await this._tree.collapse(connectionProfile); // Rerendering node to turn the badge red await this._tree.rerender(connectionProfile); connectionProfile.isDisconnecting = true; await this._tree.updateChildren(connectionProfile); connectionProfile.isDisconnecting = false; // Make the connection dirty so that the next expansion will refresh the node + // Collapse the node + await this._tree.collapse(connectionProfile); await this._tree.makeElementDirty(connectionProfile); await this._tree.revealSelectFocusElement(connectionProfile); }