@@ -37,8 +37,6 @@ public class PullRequestStatusBarManager
3737 readonly Lazy < ITeamExplorerContext > teamExplorerContext ;
3838 readonly Lazy < IConnectionManager > connectionManager ;
3939
40- IDisposable currentSessionSubscription ;
41-
4240 [ ImportingConstructor ]
4341 public PullRequestStatusBarManager (
4442 Lazy < IUsageTracker > usageTracker ,
@@ -68,23 +66,19 @@ public void StartShowingStatus()
6866 {
6967 try
7068 {
71- teamExplorerContext . Value . WhenAnyValue ( x => x . ActiveRepository )
69+ var activeReposities = teamExplorerContext . Value . WhenAnyValue ( x => x . ActiveRepository ) ;
70+ var sessions = pullRequestSessionManager . Value . WhenAnyValue ( x => x . CurrentSession ) ;
71+ activeReposities
72+ . CombineLatest ( sessions , ( r , s ) => ( r , s ) )
7273 . ObserveOn ( RxApp . MainThreadScheduler )
73- . Subscribe ( x => RefreshActiveRepository ( x ) ) ;
74+ . Subscribe ( x => RefreshCurrentSession ( x . r , x . s ) . Forget ( ) ) ;
7475 }
7576 catch ( Exception e )
7677 {
7778 log . Error ( e , "Error initializing" ) ;
7879 }
7980 }
8081
81- void RefreshActiveRepository ( ILocalRepositoryModel repository )
82- {
83- currentSessionSubscription ? . Dispose ( ) ;
84- currentSessionSubscription = pullRequestSessionManager . Value . WhenAnyValue ( x => x . CurrentSession )
85- . Subscribe ( x => RefreshCurrentSession ( repository , x ) . Forget ( ) ) ;
86- }
87-
8882 async Task RefreshCurrentSession ( ILocalRepositoryModel repository , IPullRequestSession session )
8983 {
9084 try
0 commit comments