File tree Expand file tree Collapse file tree
src/vs/workbench/browser/parts/views Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments