Skip to content

Removed bogus .Filter() overload #1013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,6 @@ namespace DynamicData.Alias
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)
where TObject : notnull
where TKey : notnull { }
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)
where TObject : notnull
where TKey : notnull { }
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)
where TObject : notnull
where TKey : notnull { }
Expand Down Expand Up @@ -1326,9 +1323,6 @@ namespace DynamicData
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)
where TObject : notnull
where TKey : notnull { }
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)
where TObject : notnull
where TKey : notnull { }
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)
where TObject : notnull
where TKey : notnull { }
Expand Down
5 changes: 4 additions & 1 deletion src/DynamicData.Tests/Cache/FilterControllerFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ public void ReapplyFilterDoesntThrow()
using var source = new SourceCache<Person, string>(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<Func<Person, bool>>(static _ => true),
reapplyFilter: Observable.Return(Unit.Default))
.AsObservableCache());
Assert.Null(ex);
}

Expand Down
18 changes: 0 additions & 18 deletions src/DynamicData/Alias/ObservableCacheAlias.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,24 +292,6 @@ public static IObservable<IChangeSet<TObject, TKey>> Where<TObject, TKey>(this I
return source.Filter(predicateChanged);
}

/// <summary>
/// Creates a filtered stream which can be dynamically filtered.
/// </summary>
/// <typeparam name="TObject">The type of the object.</typeparam>
/// <typeparam name="TKey">The type of the key.</typeparam>
/// <param name="source">The source.</param>
/// <param name="reapplyFilter">Observable to re-evaluate whether the filter still matches items. Use when filtering on mutable values.</param>
/// <returns>An observable which emits the change set.</returns>
public static IObservable<IChangeSet<TObject, TKey>> Where<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<Unit> reapplyFilter)
where TObject : notnull
where TKey : notnull
{
source.ThrowArgumentNullExceptionIfNull(nameof(source));
reapplyFilter.ThrowArgumentNullExceptionIfNull(nameof(reapplyFilter));

return source.Filter(reapplyFilter);
}

/// <summary>
/// Creates a filtered stream which can be dynamically filtered.
/// </summary>
Expand Down
19 changes: 0 additions & 19 deletions src/DynamicData/Cache/ObservableCacheEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1542,25 +1542,6 @@
predicate: predicate,
suppressEmptyChangeSets: suppressEmptyChangeSets);

/// <summary>
/// Creates a filtered stream which can be dynamically filtered.
/// </summary>
/// <typeparam name="TObject">The type of the object.</typeparam>
/// <typeparam name="TKey">The type of the key.</typeparam>
/// <param name="source">The source.</param>
/// <param name="reapplyFilter">Observable to re-evaluate whether the filter still matches items. Use when filtering on mutable values.</param>
/// <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>
/// <returns>An observable which emits change sets.</returns>
public static IObservable<IChangeSet<TObject, TKey>> Filter<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<Unit> reapplyFilter, bool suppressEmptyChangeSets = true)
where TObject : notnull
where TKey : notnull
{
source.ThrowArgumentNullExceptionIfNull(nameof(source));
reapplyFilter.ThrowArgumentNullExceptionIfNull(nameof(reapplyFilter));

return source.Filter(Observable.Empty<Func<TObject, bool>>(), reapplyFilter, suppressEmptyChangeSets);
}

/// <summary>
/// Creates a filtered stream which can be dynamically filtered.
/// </summary>
Expand Down Expand Up @@ -4202,7 +4183,7 @@
source = source ?? throw new ArgumentNullException(nameof(source));
expression = expression ?? throw new ArgumentNullException(nameof(expression));

return source.Sort(

Check warning on line 4186 in src/DynamicData/Cache/ObservableCacheEx.cs

View workflow job for this annotation

GitHub Actions / build

'ObservableCacheEx.Sort<TObject, TKey>(IObservable<IChangeSet<TObject, TKey>>, IComparer<TObject>, SortOptimisations, int)' is obsolete: 'Use SortAndBind as it's more efficient'

Check warning on line 4186 in src/DynamicData/Cache/ObservableCacheEx.cs

View workflow job for this annotation

GitHub Actions / build

'ObservableCacheEx.Sort<TObject, TKey>(IObservable<IChangeSet<TObject, TKey>>, IComparer<TObject>, SortOptimisations, int)' is obsolete: 'Use SortAndBind as it's more efficient'

Check warning on line 4186 in src/DynamicData/Cache/ObservableCacheEx.cs

View workflow job for this annotation

GitHub Actions / build

'ObservableCacheEx.Sort<TObject, TKey>(IObservable<IChangeSet<TObject, TKey>>, IComparer<TObject>, SortOptimisations, int)' is obsolete: 'Use SortAndBind as it's more efficient'

Check warning on line 4186 in src/DynamicData/Cache/ObservableCacheEx.cs

View workflow job for this annotation

GitHub Actions / build

'ObservableCacheEx.Sort<TObject, TKey>(IObservable<IChangeSet<TObject, TKey>>, IComparer<TObject>, SortOptimisations, int)' is obsolete: 'Use SortAndBind as it's more efficient'

Check warning on line 4186 in src/DynamicData/Cache/ObservableCacheEx.cs

View workflow job for this annotation

GitHub Actions / build

'ObservableCacheEx.Sort<TObject, TKey>(IObservable<IChangeSet<TObject, TKey>>, IComparer<TObject>, SortOptimisations, int)' is obsolete: 'Use SortAndBind as it's more efficient'

Check warning on line 4186 in src/DynamicData/Cache/ObservableCacheEx.cs

View workflow job for this annotation

GitHub Actions / build

'ObservableCacheEx.Sort<TObject, TKey>(IObservable<IChangeSet<TObject, TKey>>, IComparer<TObject>, SortOptimisations, int)' is obsolete: 'Use SortAndBind as it's more efficient'
sortOrder switch
{
SortDirection.Descending => SortExpressionComparer<TObject>.Descending(expression),
Expand Down
Loading