@@ -28,6 +28,7 @@ import { MenuId } from '../../../../platform/actions/common/actions.js';
28
28
import { IHoverService } from '../../../../platform/hover/browser/hover.js' ;
29
29
import { observableConfigValue } from '../../../../platform/observable/common/platformObservableUtils.js' ;
30
30
import { autorun , IObservable , observableSignalFromEvent } from '../../../../base/common/observable.js' ;
31
+ import { Sequencer } from '../../../../base/common/async.js' ;
31
32
32
33
class ListDelegate implements IListVirtualDelegate < ISCMRepository > {
33
34
@@ -85,6 +86,7 @@ export class SCMRepositoriesViewPane extends ViewPane {
85
86
private treeViewModel ! : SCMRepositoriesViewModel ;
86
87
private treeDataSource ! : RepositoryTreeDataSource ;
87
88
private treeIdentityProvider ! : RepositoryTreeIdentityProvider ;
89
+ private readonly treeOperationSequencer = new Sequencer ( ) ;
88
90
89
91
private readonly visibleCountObs : IObservable < number > ;
90
92
private readonly providerCountBadgeObs : IObservable < 'hidden' | 'auto' | 'visible' > ;
@@ -133,26 +135,28 @@ export class SCMRepositoriesViewPane extends ViewPane {
133
135
this . treeViewModel = this . instantiationService . createInstance ( SCMRepositoriesViewModel ) ;
134
136
this . _register ( this . treeViewModel ) ;
135
137
136
- // Initial rendering
137
- await this . tree . setInput ( this . treeViewModel ) ;
138
-
139
- // scm.repositories.visible setting
140
- this . visibilityDisposables . add ( autorun ( reader => {
141
- const visibleCount = this . visibleCountObs . read ( reader ) ;
142
- this . updateBodySize ( visibleCount ) ;
143
- } ) ) ;
144
-
145
- // onDidChangeRepositoriesSignal
146
- this . visibilityDisposables . add ( autorun ( async reader => {
147
- this . treeViewModel . onDidChangeRepositoriesSignal . read ( reader ) ;
148
- await this . updateChildren ( ) ;
149
- } ) ) ;
150
-
151
- // onDidChangeVisibleRepositoriesSignal
152
- this . visibilityDisposables . add ( autorun ( async reader => {
153
- this . treeViewModel . onDidChangeVisibleRepositoriesSignal . read ( reader ) ;
154
- this . updateTreeSelection ( ) ;
155
- } ) ) ;
138
+ this . treeOperationSequencer . queue ( async ( ) => {
139
+ // Initial rendering
140
+ await this . tree . setInput ( this . treeViewModel ) ;
141
+
142
+ // scm.repositories.visible setting
143
+ this . visibilityDisposables . add ( autorun ( reader => {
144
+ const visibleCount = this . visibleCountObs . read ( reader ) ;
145
+ this . updateBodySize ( visibleCount ) ;
146
+ } ) ) ;
147
+
148
+ // onDidChangeRepositoriesSignal
149
+ this . visibilityDisposables . add ( autorun ( async reader => {
150
+ this . treeViewModel . onDidChangeRepositoriesSignal . read ( reader ) ;
151
+ await this . treeOperationSequencer . queue ( ( ) => this . updateChildren ( ) ) ;
152
+ } ) ) ;
153
+
154
+ // onDidChangeVisibleRepositoriesSignal
155
+ this . visibilityDisposables . add ( autorun ( async reader => {
156
+ this . treeViewModel . onDidChangeVisibleRepositoriesSignal . read ( reader ) ;
157
+ await this . treeOperationSequencer . queue ( async ( ) => this . updateTreeSelection ( ) ) ;
158
+ } ) ) ;
159
+ } ) ;
156
160
} , this , this . _store ) ;
157
161
}
158
162
0 commit comments