From e89e149116677740fe1ad8ca237e0628442e4707 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 26 Mar 2019 16:40:30 -0400 Subject: [PATCH] Revert "Disabling caching for the repository clone view" This reverts commit f7e42eb68cf45ffe10fbc50ae47ad9364793833d. --- .../Dialog/Clone/SelectPageViewModelDesigner.cs | 1 + .../Dialog/Clone/RepositorySelectViewModel.cs | 12 +++++++++++- .../Dialog/Clone/IRepositorySelectViewModel.cs | 1 + .../Views/Dialog/Clone/SelectPageView.xaml | 10 +++++----- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/GitHub.App/SampleData/Dialog/Clone/SelectPageViewModelDesigner.cs b/src/GitHub.App/SampleData/Dialog/Clone/SelectPageViewModelDesigner.cs index 14ad9d514e..7ef7921da3 100644 --- a/src/GitHub.App/SampleData/Dialog/Clone/SelectPageViewModelDesigner.cs +++ b/src/GitHub.App/SampleData/Dialog/Clone/SelectPageViewModelDesigner.cs @@ -41,6 +41,7 @@ public SelectPageViewModelDesigner() public ICollectionView ItemsView { get; } public IRepositoryItemViewModel SelectedItem { get; set; } public RepositoryModel Repository { get; } + public ReactiveCommand Refresh { get; } public void Initialize(IConnection connection) { diff --git a/src/GitHub.App/ViewModels/Dialog/Clone/RepositorySelectViewModel.cs b/src/GitHub.App/ViewModels/Dialog/Clone/RepositorySelectViewModel.cs index bf45c4ec78..63311a2607 100644 --- a/src/GitHub.App/ViewModels/Dialog/Clone/RepositorySelectViewModel.cs +++ b/src/GitHub.App/ViewModels/Dialog/Clone/RepositorySelectViewModel.cs @@ -35,6 +35,7 @@ public class RepositorySelectViewModel : ViewModelBase, IRepositorySelectViewMod ICollectionView itemsView; ObservableAsPropertyHelper repository; IRepositoryItemViewModel selectedItem; + static bool firstLoad = true; [ImportingConstructor] public RepositorySelectViewModel(IRepositoryCloneService service, IGitHubContextService gitHubContextService) @@ -57,6 +58,12 @@ public RepositorySelectViewModel(IRepositoryCloneService service, IGitHubContext .ToProperty(this, x => x.Repository); this.WhenAnyValue(x => x.Filter).Subscribe(_ => ItemsView?.Refresh()); + + Refresh = ReactiveCommand.CreateFromTask(async () => + { + await this.LoadItems(true); + return Unit.Default; + }); } public Exception Error @@ -101,6 +108,8 @@ public IRepositoryItemViewModel SelectedItem set => this.RaiseAndSetIfChanged(ref selectedItem, value); } + public ReactiveCommand Refresh { get; } + public RepositoryModel Repository => repository.Value; public void Initialize(IConnection connection) @@ -113,7 +122,8 @@ public void Initialize(IConnection connection) public async Task Activate() { - await this.LoadItems(true); + await this.LoadItems(firstLoad); + firstLoad = false; } static string GroupName(KeyValuePair> group, int max) diff --git a/src/GitHub.Exports.Reactive/ViewModels/Dialog/Clone/IRepositorySelectViewModel.cs b/src/GitHub.Exports.Reactive/ViewModels/Dialog/Clone/IRepositorySelectViewModel.cs index b8cf181f63..ba74adfb19 100644 --- a/src/GitHub.Exports.Reactive/ViewModels/Dialog/Clone/IRepositorySelectViewModel.cs +++ b/src/GitHub.Exports.Reactive/ViewModels/Dialog/Clone/IRepositorySelectViewModel.cs @@ -16,6 +16,7 @@ public interface IRepositorySelectViewModel : IRepositoryCloneTabViewModel IReadOnlyList Items { get; } ICollectionView ItemsView { get; } IRepositoryItemViewModel SelectedItem { get; set; } + ReactiveCommand Refresh { get; } void Initialize(IConnection connection); } diff --git a/src/GitHub.VisualStudio.UI/Views/Dialog/Clone/SelectPageView.xaml b/src/GitHub.VisualStudio.UI/Views/Dialog/Clone/SelectPageView.xaml index 9dd656640f..513e87ae6a 100644 --- a/src/GitHub.VisualStudio.UI/Views/Dialog/Clone/SelectPageView.xaml +++ b/src/GitHub.VisualStudio.UI/Views/Dialog/Clone/SelectPageView.xaml @@ -21,11 +21,11 @@ - - + + + +