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

Commit 4e1f92d

Browse files
authored
Merge pull request #1381 from github/fixes/1380-prlist-fork-switch
Fix Switching Between Fork and Parent PRs
2 parents ba29d80 + 38f9724 commit 4e1f92d

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)