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

Commit 57faea9

Browse files
committed
Clear navigator when repository changes.
Previously we were only clearing it when it changes to a new valid repository. Instead clear it if the TE context is cleared for example. We need to check that the repository is actually different here because `TeamExplorerRepositoryHolder` sometimes notifies a change when the repository has not changed.
1 parent a5be346 commit 57faea9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public sealed class GitHubPaneViewModel : ViewModelBase, IGitHubPaneViewModel, I
4646
readonly ReactiveCommand<Unit> refresh;
4747
readonly ReactiveCommand<Unit> showPullRequests;
4848
readonly ReactiveCommand<object> openInBrowser;
49+
bool initialized;
4950
IViewModel content;
5051
ILocalRepositoryModel localRepository;
5152
string searchQuery;
@@ -343,10 +344,13 @@ async Task NavigateTo<TViewModel>(Func<TViewModel, Task> initialize, Func<TViewM
343344

344345
async Task UpdateContent(ILocalRepositoryModel repository)
345346
{
347+
if (initialized && Equals(repository, LocalRepository)) return;
348+
349+
initialized = true;
346350
LocalRepository = repository;
347351
Connection = null;
348-
349352
Content = null;
353+
navigator.Clear();
350354

351355
if (repository == null)
352356
{
@@ -372,7 +376,6 @@ async Task UpdateContent(ILocalRepositoryModel repository)
372376

373377
if (Connection != null)
374378
{
375-
navigator.Clear();
376379
Content = navigator;
377380
await ShowDefaultPage();
378381
}

0 commit comments

Comments
 (0)