From d361753c2f0f09a818c7b381f431bded9aa3490b Mon Sep 17 00:00:00 2001 From: trawzified <55751269+tr4wzified@users.noreply.github.com> Date: Wed, 27 Dec 2023 18:30:01 +0100 Subject: [PATCH] Improve search responsiveness with a throttle --- Wabbajack.App.Wpf/Views/ModListGalleryView.xaml.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Wabbajack.App.Wpf/Views/ModListGalleryView.xaml.cs b/Wabbajack.App.Wpf/Views/ModListGalleryView.xaml.cs index 04a91098..187edc73 100644 --- a/Wabbajack.App.Wpf/Views/ModListGalleryView.xaml.cs +++ b/Wabbajack.App.Wpf/Views/ModListGalleryView.xaml.cs @@ -1,4 +1,5 @@ -using System.Reactive.Disposables; +using System; +using System.Reactive.Disposables; using System.Reactive.Linq; using System.Windows; using ReactiveUI; @@ -44,7 +45,10 @@ namespace Wabbajack .DisposeWith(dispose); - this.BindStrict(ViewModel, vm => vm.Search, x => x.SearchBox.Text) + this.WhenAny(x => x.SearchBox.Text) + .Throttle(TimeSpan.FromSeconds(0.2), RxApp.TaskpoolScheduler) + .Select(x => x?.Trim()) + .BindToStrict(this, x => x.ViewModel.Search) .DisposeWith(dispose); this.BindStrict(ViewModel, vm => vm.OnlyInstalled, x => x.OnlyInstalledCheckbox.IsChecked)