@@ -18,7 +18,7 @@ import { fromNow } from 'vs/base/common/date';
18
18
import { createMatches , FuzzyScore , IMatch } from 'vs/base/common/filters' ;
19
19
import { MarkdownString } from 'vs/base/common/htmlContent' ;
20
20
import { combinedDisposable , Disposable , DisposableMap , DisposableStore , IDisposable } from 'vs/base/common/lifecycle' ;
21
- import { autorun , autorunWithStore , IObservable , observableValue } from 'vs/base/common/observable' ;
21
+ import { autorun , autorunWithStore , IObservable , ISettableObservable , observableValue } from 'vs/base/common/observable' ;
22
22
import { ThemeIcon } from 'vs/base/common/themables' ;
23
23
import { localize } from 'vs/nls' ;
24
24
import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
@@ -362,7 +362,7 @@ class HistoryItemLoadMoreRenderer implements ITreeRenderer<SCMHistoryItemLoadMor
362
362
get templateId ( ) : string { return HistoryItemLoadMoreRenderer . TEMPLATE_ID ; }
363
363
364
364
constructor (
365
- private readonly _loadingMore : IObservable < boolean > ,
365
+ private readonly _loadingMore : ( repository : ISCMRepository ) => IObservable < boolean > ,
366
366
private readonly _loadMoreCallback : ( repository : ISCMRepository ) => void ,
367
367
@IConfigurationService private readonly _configurationService : IConfigurationService ,
368
368
@ISCMViewService private readonly _scmViewService : ISCMViewService ) { }
@@ -391,7 +391,7 @@ class HistoryItemLoadMoreRenderer implements ITreeRenderer<SCMHistoryItemLoadMor
391
391
392
392
if ( repositoryCount > 1 || alwaysShowRepositories ) {
393
393
templateData . elementDisposables . add ( autorun ( reader => {
394
- const loadingMore = this . _loadingMore . read ( reader ) ;
394
+ const loadingMore = this . _loadingMore ( element . element . repository ) . read ( reader ) ;
395
395
const icon = `$(${ loadingMore ? 'loading~spin' : 'fold-down' } )` ;
396
396
397
397
templateData . historyItemPlaceholderLabel . setLabel ( localize ( 'loadMore' , "{0} Load More..." , icon ) ) ;
@@ -667,7 +667,7 @@ export class SCMHistoryViewPane extends ViewPane {
667
667
private _tree ! : WorkbenchAsyncDataTree < ISCMViewService , TreeElement , FuzzyScore > ;
668
668
private _treeDataSource ! : SCMHistoryTreeDataSource ;
669
669
private _treeIdentityProvider ! : SCMHistoryTreeIdentityProvider ;
670
- private _isLoadMore = observableValue ( this , false ) ;
670
+ private _repositoryLoadMore = new Map < ISCMRepository , ISettableObservable < boolean > > ( ) ;
671
671
672
672
private readonly _repositories = new DisposableMap < ISCMRepository > ( ) ;
673
673
private readonly _visibilityDisposables = new DisposableStore ( ) ;
@@ -773,7 +773,7 @@ export class SCMHistoryViewPane extends ViewPane {
773
773
[
774
774
this . instantiationService . createInstance ( RepositoryRenderer , getActionViewItemProvider ( this . instantiationService ) ) ,
775
775
this . instantiationService . createInstance ( HistoryItemRenderer , historyItemHoverDelegate ) ,
776
- this . instantiationService . createInstance ( HistoryItemLoadMoreRenderer , this . _isLoadMore , repository => this . _loadMoreCallback ( repository ) ) ,
776
+ this . instantiationService . createInstance ( HistoryItemLoadMoreRenderer , repository => this . _getLoadMore ( repository ) , repository => this . _loadMoreCallback ( repository ) ) ,
777
777
] ,
778
778
this . _treeDataSource ,
779
779
{
@@ -888,6 +888,7 @@ export class SCMHistoryViewPane extends ViewPane {
888
888
// Removed repositories
889
889
for ( const repository of removed ) {
890
890
this . _treeDataSource . clearState ( repository ) ;
891
+ this . _repositoryLoadMore . delete ( repository ) ;
891
892
this . _repositories . deleteAndDispose ( repository ) ;
892
893
}
893
894
@@ -906,16 +907,27 @@ export class SCMHistoryViewPane extends ViewPane {
906
907
. filter ( r => ! ! r && isSCMHistoryItemViewModelTreeElement ( r ) ) ! ;
907
908
}
908
909
910
+ private _getLoadMore ( repository : ISCMRepository ) : ISettableObservable < boolean > {
911
+ let loadMore = this . _repositoryLoadMore . get ( repository ) ;
912
+ if ( ! loadMore ) {
913
+ loadMore = observableValue < boolean > ( this , false ) ;
914
+ this . _repositoryLoadMore . set ( repository , loadMore ) ;
915
+ }
916
+
917
+ return loadMore ;
918
+ }
919
+
909
920
private _loadMoreCallback ( repository : ISCMRepository ) : void {
910
- if ( this . _isLoadMore . get ( ) ) {
921
+ const loadMore = this . _getLoadMore ( repository ) ;
922
+ if ( loadMore . get ( ) ) {
911
923
return ;
912
924
}
913
925
914
- this . _isLoadMore . set ( true , undefined ) ;
926
+ loadMore . set ( true , undefined ) ;
915
927
this . _treeDataSource . loadMore ( repository ) ;
916
928
917
929
this . _updateChildren ( repository )
918
- . finally ( ( ) => this . _isLoadMore . set ( false , undefined ) ) ;
930
+ . finally ( ( ) => loadMore . set ( false , undefined ) ) ;
919
931
}
920
932
921
933
private _updateChildren ( element ?: ISCMRepository ) : Promise < void > {
0 commit comments