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

Commit 38f9724

Browse files
committed
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
1 parent ba29d80 commit 38f9724

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ public PullRequestListViewModel(
8888
.Where(x => PullRequests != null)
8989
.Subscribe(f => UpdateFilter(SelectedState, SelectedAssignee, SelectedAuthor, f));
9090

91+
this.WhenAnyValue(x => x.SelectedRepository)
92+
.Skip(1)
93+
.Subscribe(_ => ResetAndLoad());
94+
9195
OpenPullRequest = ReactiveCommand.Create();
9296
OpenPullRequest.Subscribe(DoOpenPullRequest);
9397
CreatePullRequest = ReactiveCommand.Create();
@@ -117,9 +121,9 @@ public async Task InitializeAsync(ILocalRepositoryModel repository, IConnection
117121
new[] { remoteRepository.Parent, remoteRepository } :
118122
new[] { remoteRepository };
119123
SelectedState = States.FirstOrDefault(x => x.Name == listSettings.SelectedState) ?? States[0];
124+
125+
// Setting SelectedRepository will cause a Load().
120126
SelectedRepository = Repositories[0];
121-
WebUrl = repository.CloneUrl?.ToRepositoryUrl().Append("pulls");
122-
await Load();
123127
}
124128
finally
125129
{
@@ -321,6 +325,7 @@ void CreatePullRequests()
321325

322326
void ResetAndLoad()
323327
{
328+
WebUrl = SelectedRepository.CloneUrl?.ToRepositoryUrl().Append("pulls");
324329
CreatePullRequests();
325330
UpdateFilter(SelectedState, SelectedAssignee, SelectedAuthor, SearchQuery);
326331
Load().Forget();

0 commit comments

Comments
 (0)