@@ -5,7 +5,6 @@ import { GitUri } from '../../git/gitService';
55import { Logger } from '../../logger' ;
66import { debug , Functions , gate } from '../../system' ;
77import { RepositoriesView } from '../repositoriesView' ;
8- import { RefreshReason } from '../viewBase' ;
98import { MessageNode } from './common' ;
109import { RepositoryNode } from './repositoryNode' ;
1110import { ResourceType , SubscribeableViewNode , unknownGitUri , ViewNode } from './viewNode' ;
@@ -20,14 +19,19 @@ export class RepositoriesNode extends SubscribeableViewNode<RepositoriesView> {
2019 dispose ( ) {
2120 super . dispose ( ) ;
2221
23- if ( this . _children !== undefined ) {
24- for ( const child of this . _children ) {
25- if ( child instanceof RepositoryNode ) {
26- child . dispose ( ) ;
27- }
22+ this . resetChildren ( ) ;
23+ }
24+
25+ @debug ( )
26+ private resetChildren ( ) {
27+ if ( this . _children === undefined ) return ;
28+
29+ for ( const child of this . _children ) {
30+ if ( child instanceof RepositoryNode ) {
31+ child . dispose ( ) ;
2832 }
29- this . _children = undefined ;
3033 }
34+ this . _children = undefined ;
3135 }
3236
3337 async getChildren ( ) : Promise < ViewNode [ ] > {
@@ -59,9 +63,17 @@ export class RepositoriesNode extends SubscribeableViewNode<RepositoriesView> {
5963
6064 @gate ( )
6165 @debug ( )
62- async refresh ( reason ?: RefreshReason ) {
66+ async refresh ( reset : boolean = false ) {
6367 if ( this . _children === undefined ) return ;
6468
69+ if ( reset ) {
70+ this . resetChildren ( ) ;
71+ await this . unsubscribe ( ) ;
72+ void this . ensureSubscription ( ) ;
73+
74+ return ;
75+ }
76+
6577 const repositories = await Container . git . getOrderedRepositories ( ) ;
6678 if ( repositories . length === 0 && ( this . _children === undefined || this . _children . length === 0 ) ) return ;
6779
@@ -93,11 +105,6 @@ export class RepositoriesNode extends SubscribeableViewNode<RepositoriesView> {
93105
94106 this . _children = children ;
95107
96- // Reset our subscription if the configuration changed
97- if ( reason === RefreshReason . ConfigurationChanged ) {
98- await this . unsubscribe ( ) ;
99- }
100-
101108 void this . ensureSubscription ( ) ;
102109 }
103110
0 commit comments