mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-03 17:23:42 -05:00
Fix refreshing nodes in Azure view (#9215)
* Fix refreshing nodes in Azure view * refactor * Remove refreshNode from shim * Add missing await
This commit is contained in:
@@ -698,26 +698,28 @@ class TreeDataSource implements IAsyncDataSource<ITreeItem, ITreeItem> {
|
||||
return this.treeView.dataProvider && node.collapsibleState !== TreeItemCollapsibleState.None;
|
||||
}
|
||||
|
||||
getChildren(node: ITreeItem): Promise<any[]> {
|
||||
async getChildren(node: ITreeItem): Promise<any[]> {
|
||||
if (node.childProvider) {
|
||||
return this.withProgress(this.objectExplorerService.getChildren(node, this.id)).catch(e => {
|
||||
try {
|
||||
return await this.withProgress(this.objectExplorerService.getChildren(node, this.id));
|
||||
} catch (err) {
|
||||
// if some error is caused we assume something tangently happened
|
||||
// i.e the user could retry if they wanted.
|
||||
// So in order to enable this we need to tell the tree to refresh this node so it will ask us for the data again
|
||||
setTimeout(() => {
|
||||
this.treeView.collapse(node);
|
||||
if (e instanceof UserCancelledConnectionError) {
|
||||
if (err instanceof UserCancelledConnectionError) {
|
||||
return;
|
||||
}
|
||||
this.treeView.refresh([node]);
|
||||
});
|
||||
return [];
|
||||
});
|
||||
}
|
||||
}
|
||||
if (this.treeView.dataProvider) {
|
||||
return this.withProgress(this.treeView.dataProvider.getChildren(node));
|
||||
return await this.withProgress(this.treeView.dataProvider.getChildren(node));
|
||||
}
|
||||
return Promise.resolve([]);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user