Cleaning update children logic in async server tree (#22550)

This commit is contained in:
Aasim Khan
2023-03-30 15:17:45 -07:00
committed by GitHub
parent 2e1689b44d
commit 4ff16885c1

View File

@@ -125,18 +125,9 @@ export class AsyncServerTree extends WorkbenchAsyncDataTree<ConnectionProfileGro
}
public override async updateChildren(element?: ServerTreeElement, recursive?: boolean, rerender?: boolean, options?: IAsyncDataTreeUpdateChildrenOptions<ServerTreeElement>): Promise<void> {
const viewState = this.getViewState();
const expandedElementIds = viewState?.expanded;
const expandedChildren = this.getExpandedState(element);
await super.updateChildren(element, recursive, rerender, options);
if (expandedElementIds) {
for (let i = 0; i <= expandedElementIds.length; i++) {
const id = expandedElementIds[i];
const node = this.getDataNodeById(id);
if (node) {
await this.expand(node.element);
}
}
}
await this.expandElements(expandedChildren);
}
public async expandElements(elements: ServerTreeElement[]): Promise<void> {