Fixing delete server group error when we try to focus on root (#23019)

This commit is contained in:
Aasim Khan
2023-05-08 09:46:40 -07:00
committed by GitHub
parent 4b9147a6a0
commit 6fa948adbe

View File

@@ -144,6 +144,12 @@ export class AsyncServerTree extends WorkbenchAsyncDataTree<ConnectionProfileGro
}
public async revealSelectFocusElement(element: ServerTreeElement) {
const dataNode = this.getDataNode(element);
// The root of the tree is a special case as it is not rendered
// so we instead reveal select and focus on the first child of the root.
if (dataNode === this.root) {
element = dataNode.children[0].element;
}
await this.reveal(element);
await this.setSelection([element]);
this.setFocus([element]);