Skip to content

Commit bd9df0a

Browse files
authored
fetching pull requests failed in infinite loop when proxy is unavailable (#6568)
Fixes #6063
1 parent ce0a7fa commit bd9df0a

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/view/treeNodes/categoryNode.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,18 @@ export class CategoryTreeNode extends TreeNode implements vscode.TreeItem {
302302

303303
override async getChildren(): Promise<TreeNode[]> {
304304
await super.getChildren();
305-
if (!this._prsTreeModel.hasLoaded) {
306-
this.doGetChildren().then(() => this.refresh(this));
307-
return [];
305+
const isFirstLoad = !this._firstLoad;
306+
if (isFirstLoad) {
307+
this._firstLoad = this.doGetChildren();
308+
if (!this._prsTreeModel.hasLoaded) {
309+
this._firstLoad.then(() => this.refresh(this));
310+
return [];
311+
}
308312
}
309-
return this.doGetChildren();
313+
return isFirstLoad ? this._firstLoad! : this.doGetChildren();
310314
}
311315

316+
private _firstLoad: Promise<TreeNode[]> | undefined;
312317
private async doGetChildren(): Promise<TreeNode[]> {
313318
let hasMorePages = false;
314319
let hasUnsearchedRepositories = false;

0 commit comments

Comments
 (0)