From 38f972456a5f2217be41470d3f85e505ffc644bc Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 12 Dec 2017 17:24:54 +0100 Subject: [PATCH] Fix switching between fork and master PRs #1367 accidentially removed the code to refresh the PR list when switching between fork and parent PRs. Also update the `WebUrl` when this happens to fix #1218. Fixes #1380 Fixes #1218 --- .../ViewModels/GitHubPane/PullRequestListViewModel.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/GitHub.App/ViewModels/GitHubPane/PullRequestListViewModel.cs b/src/GitHub.App/ViewModels/GitHubPane/PullRequestListViewModel.cs index 1c26794697..d60cd427f5 100644 --- a/src/GitHub.App/ViewModels/GitHubPane/PullRequestListViewModel.cs +++ b/src/GitHub.App/ViewModels/GitHubPane/PullRequestListViewModel.cs @@ -88,6 +88,10 @@ public PullRequestListViewModel( .Where(x => PullRequests != null) .Subscribe(f => UpdateFilter(SelectedState, SelectedAssignee, SelectedAuthor, f)); + this.WhenAnyValue(x => x.SelectedRepository) + .Skip(1) + .Subscribe(_ => ResetAndLoad()); + OpenPullRequest = ReactiveCommand.Create(); OpenPullRequest.Subscribe(DoOpenPullRequest); CreatePullRequest = ReactiveCommand.Create(); @@ -117,9 +121,9 @@ public async Task InitializeAsync(ILocalRepositoryModel repository, IConnection new[] { remoteRepository.Parent, remoteRepository } : new[] { remoteRepository }; SelectedState = States.FirstOrDefault(x => x.Name == listSettings.SelectedState) ?? States[0]; + + // Setting SelectedRepository will cause a Load(). SelectedRepository = Repositories[0]; - WebUrl = repository.CloneUrl?.ToRepositoryUrl().Append("pulls"); - await Load(); } finally { @@ -321,6 +325,7 @@ void CreatePullRequests() void ResetAndLoad() { + WebUrl = SelectedRepository.CloneUrl?.ToRepositoryUrl().Append("pulls"); CreatePullRequests(); UpdateFilter(SelectedState, SelectedAssignee, SelectedAuthor, SearchQuery); Load().Forget();