From 5d07a3742919399492132c6b346ad14c05587dfe Mon Sep 17 00:00:00 2001 From: JakenVeina Date: Thu, 29 May 2025 01:22:35 -0500 Subject: [PATCH] Removed bogus .Filter() overload that did not allow the consumer to supply filtering logic, resulting in all items always being filtered out. --- ...ts.DynamicDataTests.DotNet9_0.verified.txt | 6 ------ .../Cache/FilterControllerFixture.cs | 5 ++++- src/DynamicData/Alias/ObservableCacheAlias.cs | 18 ------------------ src/DynamicData/Cache/ObservableCacheEx.cs | 19 ------------------- 4 files changed, 4 insertions(+), 44 deletions(-) diff --git a/src/DynamicData.Tests/API/ApiApprovalTests.DynamicDataTests.DotNet9_0.verified.txt b/src/DynamicData.Tests/API/ApiApprovalTests.DynamicDataTests.DotNet9_0.verified.txt index e594d8a7..22419dd4 100644 --- a/src/DynamicData.Tests/API/ApiApprovalTests.DynamicDataTests.DotNet9_0.verified.txt +++ b/src/DynamicData.Tests/API/ApiApprovalTests.DynamicDataTests.DotNet9_0.verified.txt @@ -279,9 +279,6 @@ namespace DynamicData.Alias public static System.IObservable> Where(this System.IObservable> source, System.IObservable> predicateChanged) where TObject : notnull where TKey : notnull { } - public static System.IObservable> Where(this System.IObservable> source, System.IObservable reapplyFilter) - where TObject : notnull - where TKey : notnull { } public static System.IObservable> Where(this System.IObservable> source, System.IObservable> predicateChanged, System.IObservable reapplyFilter) where TObject : notnull where TKey : notnull { } @@ -1323,9 +1320,6 @@ namespace DynamicData public static System.IObservable> Filter(this System.IObservable> source, System.IObservable> predicateChanged, bool suppressEmptyChangeSets = true) where TObject : notnull where TKey : notnull { } - public static System.IObservable> Filter(this System.IObservable> source, System.IObservable reapplyFilter, bool suppressEmptyChangeSets = true) - where TObject : notnull - where TKey : notnull { } public static System.IObservable> Filter(this System.IObservable> source, System.IObservable> predicateChanged, System.IObservable reapplyFilter, bool suppressEmptyChangeSets = true) where TObject : notnull where TKey : notnull { } diff --git a/src/DynamicData.Tests/Cache/FilterControllerFixture.cs b/src/DynamicData.Tests/Cache/FilterControllerFixture.cs index ebe07324..940c5f77 100644 --- a/src/DynamicData.Tests/Cache/FilterControllerFixture.cs +++ b/src/DynamicData.Tests/Cache/FilterControllerFixture.cs @@ -162,7 +162,10 @@ public void ReapplyFilterDoesntThrow() using var source = new SourceCache(p => p.Key); source.AddOrUpdate(Enumerable.Range(1, 100).Select(i => new Person("P" + i, i)).ToArray()); - var ex = Record.Exception(() => source.Connect().Filter(Observable.Return(Unit.Default)).AsObservableCache()); + var ex = Record.Exception(() => source.Connect().Filter( + predicateChanged: Observable.Return>(static _ => true), + reapplyFilter: Observable.Return(Unit.Default)) + .AsObservableCache()); Assert.Null(ex); } diff --git a/src/DynamicData/Alias/ObservableCacheAlias.cs b/src/DynamicData/Alias/ObservableCacheAlias.cs index 76757476..cf10aa4d 100644 --- a/src/DynamicData/Alias/ObservableCacheAlias.cs +++ b/src/DynamicData/Alias/ObservableCacheAlias.cs @@ -292,24 +292,6 @@ public static IObservable> Where(this I return source.Filter(predicateChanged); } - /// - /// Creates a filtered stream which can be dynamically filtered. - /// - /// The type of the object. - /// The type of the key. - /// The source. - /// Observable to re-evaluate whether the filter still matches items. Use when filtering on mutable values. - /// An observable which emits the change set. - public static IObservable> Where(this IObservable> source, IObservable reapplyFilter) - where TObject : notnull - where TKey : notnull - { - source.ThrowArgumentNullExceptionIfNull(nameof(source)); - reapplyFilter.ThrowArgumentNullExceptionIfNull(nameof(reapplyFilter)); - - return source.Filter(reapplyFilter); - } - /// /// Creates a filtered stream which can be dynamically filtered. /// diff --git a/src/DynamicData/Cache/ObservableCacheEx.cs b/src/DynamicData/Cache/ObservableCacheEx.cs index aa548dbb..57729e07 100644 --- a/src/DynamicData/Cache/ObservableCacheEx.cs +++ b/src/DynamicData/Cache/ObservableCacheEx.cs @@ -1501,25 +1501,6 @@ public static IObservable> Filter - /// Creates a filtered stream which can be dynamically filtered. - /// - /// The type of the object. - /// The type of the key. - /// The source. - /// Observable to re-evaluate whether the filter still matches items. Use when filtering on mutable values. - /// By default empty changeset notifications are suppressed for performance reasons. Set to false to publish empty changesets. Doing so can be useful for monitoring loading status. - /// An observable which emits change sets. - public static IObservable> Filter(this IObservable> source, IObservable reapplyFilter, bool suppressEmptyChangeSets = true) - where TObject : notnull - where TKey : notnull - { - source.ThrowArgumentNullExceptionIfNull(nameof(source)); - reapplyFilter.ThrowArgumentNullExceptionIfNull(nameof(reapplyFilter)); - - return source.Filter(Observable.Empty>(), reapplyFilter, suppressEmptyChangeSets); - } - /// /// Creates a filtered stream which can be dynamically filtered. ///