Skip to content

Commit 88bc23e

Browse files
JakenVeinadwcullop
andauthored
Removed bogus .Filter() overload that did not allow the consumer to supply filtering logic, resulting in all items always being filtered out. (#1013)
Co-authored-by: Darrin W. Cullop <Darrin.Cullop@microsoft.com>
1 parent dcba2ff commit 88bc23e

4 files changed

Lines changed: 4 additions & 44 deletions

File tree

src/DynamicData.Tests/API/ApiApprovalTests.DynamicDataTests.DotNet9_0.verified.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,6 @@ namespace DynamicData.Alias
279279
public static System.IObservable<DynamicData.IChangeSet<TObject, TKey>> Where<TObject, TKey>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.IObservable<System.Func<TObject, bool>> predicateChanged)
280280
where TObject : notnull
281281
where TKey : notnull { }
282-
public static System.IObservable<DynamicData.IChangeSet<TObject, TKey>> Where<TObject, TKey>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.IObservable<System.Reactive.Unit> reapplyFilter)
283-
where TObject : notnull
284-
where TKey : notnull { }
285282
public static System.IObservable<DynamicData.IChangeSet<TObject, TKey>> Where<TObject, TKey>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.IObservable<System.Func<TObject, bool>> predicateChanged, System.IObservable<System.Reactive.Unit> reapplyFilter)
286283
where TObject : notnull
287284
where TKey : notnull { }
@@ -1324,9 +1321,6 @@ namespace DynamicData
13241321
public static System.IObservable<DynamicData.IChangeSet<TObject, TKey>> Filter<TObject, TKey>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.IObservable<System.Func<TObject, bool>> predicateChanged, bool suppressEmptyChangeSets = true)
13251322
where TObject : notnull
13261323
where TKey : notnull { }
1327-
public static System.IObservable<DynamicData.IChangeSet<TObject, TKey>> Filter<TObject, TKey>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.IObservable<System.Reactive.Unit> reapplyFilter, bool suppressEmptyChangeSets = true)
1328-
where TObject : notnull
1329-
where TKey : notnull { }
13301324
public static System.IObservable<DynamicData.IChangeSet<TObject, TKey>> Filter<TObject, TKey>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.IObservable<System.Func<TObject, bool>> predicateChanged, System.IObservable<System.Reactive.Unit> reapplyFilter, bool suppressEmptyChangeSets = true)
13311325
where TObject : notnull
13321326
where TKey : notnull { }

src/DynamicData.Tests/Cache/FilterControllerFixture.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,10 @@ public void ReapplyFilterDoesntThrow()
162162
using var source = new SourceCache<Person, string>(p => p.Key);
163163
source.AddOrUpdate(Enumerable.Range(1, 100).Select(i => new Person("P" + i, i)).ToArray());
164164

165-
var ex = Record.Exception(() => source.Connect().Filter(Observable.Return(Unit.Default)).AsObservableCache());
165+
var ex = Record.Exception(() => source.Connect().Filter(
166+
predicateChanged: Observable.Return<Func<Person, bool>>(static _ => true),
167+
reapplyFilter: Observable.Return(Unit.Default))
168+
.AsObservableCache());
166169
Assert.Null(ex);
167170
}
168171

src/DynamicData/Alias/ObservableCacheAlias.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -292,24 +292,6 @@ public static IObservable<IChangeSet<TObject, TKey>> Where<TObject, TKey>(this I
292292
return source.Filter(predicateChanged);
293293
}
294294

295-
/// <summary>
296-
/// Creates a filtered stream which can be dynamically filtered.
297-
/// </summary>
298-
/// <typeparam name="TObject">The type of the object.</typeparam>
299-
/// <typeparam name="TKey">The type of the key.</typeparam>
300-
/// <param name="source">The source.</param>
301-
/// <param name="reapplyFilter">Observable to re-evaluate whether the filter still matches items. Use when filtering on mutable values.</param>
302-
/// <returns>An observable which emits the change set.</returns>
303-
public static IObservable<IChangeSet<TObject, TKey>> Where<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<Unit> reapplyFilter)
304-
where TObject : notnull
305-
where TKey : notnull
306-
{
307-
source.ThrowArgumentNullExceptionIfNull(nameof(source));
308-
reapplyFilter.ThrowArgumentNullExceptionIfNull(nameof(reapplyFilter));
309-
310-
return source.Filter(reapplyFilter);
311-
}
312-
313295
/// <summary>
314296
/// Creates a filtered stream which can be dynamically filtered.
315297
/// </summary>

src/DynamicData/Cache/ObservableCacheEx.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,25 +1542,6 @@ public static IObservable<IChangeSet<TObject, TKey>> Filter<TObject, TKey, TStat
15421542
predicate: predicate,
15431543
suppressEmptyChangeSets: suppressEmptyChangeSets);
15441544

1545-
/// <summary>
1546-
/// Creates a filtered stream which can be dynamically filtered.
1547-
/// </summary>
1548-
/// <typeparam name="TObject">The type of the object.</typeparam>
1549-
/// <typeparam name="TKey">The type of the key.</typeparam>
1550-
/// <param name="source">The source.</param>
1551-
/// <param name="reapplyFilter">Observable to re-evaluate whether the filter still matches items. Use when filtering on mutable values.</param>
1552-
/// <param name="suppressEmptyChangeSets">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.</param>
1553-
/// <returns>An observable which emits change sets.</returns>
1554-
public static IObservable<IChangeSet<TObject, TKey>> Filter<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<Unit> reapplyFilter, bool suppressEmptyChangeSets = true)
1555-
where TObject : notnull
1556-
where TKey : notnull
1557-
{
1558-
source.ThrowArgumentNullExceptionIfNull(nameof(source));
1559-
reapplyFilter.ThrowArgumentNullExceptionIfNull(nameof(reapplyFilter));
1560-
1561-
return source.Filter(Observable.Empty<Func<TObject, bool>>(), reapplyFilter, suppressEmptyChangeSets);
1562-
}
1563-
15641545
/// <summary>
15651546
/// Creates a filtered stream which can be dynamically filtered.
15661547
/// </summary>

0 commit comments

Comments
 (0)