Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 2beed5e

Browse files
committed
Fix failing test.
We only want to check whether the repository has changed when we're getting the notification from `TeamExplorerRepositoryHolder` (as it sometimes signals a change when there is none) - in the case of a connection changing we _should_ update the content when the repository hasn't changed.
1 parent 49dfc46 commit 2beed5e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/GitHub.App/ViewModels/GitHubPane/GitHubPaneViewModel.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public void Dispose()
200200
public async Task InitializeAsync(IServiceProvider paneServiceProvider)
201201
{
202202
await UpdateContent(teServiceHolder.ActiveRepo);
203-
teServiceHolder.Subscribe(this, x => UpdateContent(x).Forget());
203+
teServiceHolder.Subscribe(this, x => UpdateContentIfRepositoryChanged(x).Forget());
204204
connectionManager.Connections.CollectionChanged += (_, __) => UpdateContent(LocalRepository).Forget();
205205

206206
BindNavigatorCommand(paneServiceProvider, PkgCmdIDList.pullRequestCommand, showPullRequests);
@@ -344,8 +344,6 @@ async Task NavigateTo<TViewModel>(Func<TViewModel, Task> initialize, Func<TViewM
344344

345345
async Task UpdateContent(ILocalRepositoryModel repository)
346346
{
347-
if (initialized && Equals(repository, LocalRepository)) return;
348-
349347
initialized = true;
350348
LocalRepository = repository;
351349
Connection = null;
@@ -390,6 +388,14 @@ async Task UpdateContent(ILocalRepositoryModel repository)
390388
}
391389
}
392390

391+
async Task UpdateContentIfRepositoryChanged(ILocalRepositoryModel repository)
392+
{
393+
if (!initialized || !Equals(repository, LocalRepository))
394+
{
395+
await UpdateContent(repository);
396+
}
397+
}
398+
393399
static async Task<bool> IsValidRepository(ISimpleApiClient client)
394400
{
395401
try

0 commit comments

Comments
 (0)