diff --git a/src/vs/workbench/browser/parts/views/customView.ts b/src/vs/workbench/browser/parts/views/customView.ts index d3494ac9b65ef7b1127726dbd12b14a7b2d95722..89b94f45a229476ef4640e6e49aa4b51668c31e3 100644 --- a/src/vs/workbench/browser/parts/views/customView.ts +++ b/src/vs/workbench/browser/parts/views/customView.ts @@ -451,14 +451,28 @@ export class CustomTreeView extends Disposable implements ITreeView { refresh(elements?: ITreeItem[]): Promise { if (this.dataProvider && this.tree) { - elements = elements || [this.root]; + if (!elements) { + elements = [this.root]; + // remove all waiting elements to refresh if root is asked to refresh + this.elementsToRefresh = []; + } for (const element of elements) { element.children = null; // reset children } if (this.isVisible) { return this.doRefresh(elements); } else { - this.elementsToRefresh.push(...elements); + if (this.elementsToRefresh.length) { + const seen: Set = new Set(); + this.elementsToRefresh.forEach(element => seen.add(element.handle)); + for (const element of elements) { + if (!seen.has(element.handle)) { + this.elementsToRefresh.push(element); + } + } + } else { + this.elementsToRefresh.push(...elements); + } } } return Promise.resolve(undefined);