Skip to content

Commit 7a20791

Browse files
committed
1 parent 14ce518 commit 7a20791

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

src/vs/workbench/browser/parts/views/customView.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,14 +451,28 @@ export class CustomTreeView extends Disposable implements ITreeView {
451451

452452
refresh(elements?: ITreeItem[]): Promise<void> {
453453
if (this.dataProvider && this.tree) {
454-
elements = elements || [this.root];
454+
if (!elements) {
455+
elements = [this.root];
456+
// remove all waiting elements to refresh if root is asked to refresh
457+
this.elementsToRefresh = [];
458+
}
455459
for (const element of elements) {
456460
element.children = null; // reset children
457461
}
458462
if (this.isVisible) {
459463
return this.doRefresh(elements);
460464
} else {
461-
this.elementsToRefresh.push(...elements);
465+
if (this.elementsToRefresh.length) {
466+
const seen: Set<string> = new Set<string>();
467+
this.elementsToRefresh.forEach(element => seen.add(element.handle));
468+
for (const element of elements) {
469+
if (!seen.has(element.handle)) {
470+
this.elementsToRefresh.push(element);
471+
}
472+
}
473+
} else {
474+
this.elementsToRefresh.push(...elements);
475+
}
462476
}
463477
}
464478
return Promise.resolve(undefined);

0 commit comments

Comments
 (0)