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:
Charles Gagnon
2020-02-19 16:55:17 -08:00
committed by GitHub
parent 1d0f76d26a
commit 7eef23f232
2 changed files with 15 additions and 13 deletions

View File

@@ -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 [];
}
}