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

Commit afbc83a

Browse files
shanadonokuda
authored andcommitted
Fix loading when there's no repo
1 parent c0208cc commit afbc83a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/GitHub.App/ViewModels/PullRequestListViewModel.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,18 @@ public PullRequestListViewModel(IRepositoryHost repositoryHost, ISimpleRepositor
4040
VisualStudio.Services.DefaultExportProvider.GetExportedValue<IVisualStudioBrowser>().OpenUrl(repositoryHost.Address.WebUri);
4141
});
4242

43+
PullRequests =
44+
repository.CloneUrl != null ? LoadPullRequests(repositoryHost, repository) :
45+
new TrackingCollection<IPullRequestModel>(Observable.Empty<IPullRequestModel>());
46+
PullRequests.Subscribe();
47+
}
48+
49+
static ITrackingCollection<IPullRequestModel> LoadPullRequests(IRepositoryHost repositoryHost, ISimpleRepositoryModel repository)
50+
{
4351
var list = repositoryHost.ModelService.GetPullRequests(repository);
4452
list.SetComparer(OrderedComparer<IPullRequestModel>.OrderByDescending(x => x.UpdatedAt).Compare);
4553
list.SetFilter((pr, index, l) => pr.IsOpen);
46-
PullRequests = list;
47-
list.Subscribe();
54+
return list;
4855
}
4956

5057
ITrackingCollection<IPullRequestModel> pullRequests;

0 commit comments

Comments
 (0)