diff --git a/src/DynamicData.Tests/Cache/MergeManyChangeSetsCacheSourceCompareFixture.cs b/src/DynamicData.Tests/Cache/MergeManyChangeSetsCacheSourceCompareFixture.cs index 54683c1c0..148e0ee04 100644 --- a/src/DynamicData.Tests/Cache/MergeManyChangeSetsCacheSourceCompareFixture.cs +++ b/src/DynamicData.Tests/Cache/MergeManyChangeSetsCacheSourceCompareFixture.cs @@ -52,9 +52,9 @@ public MergeManyChangeSetsCacheSourceCompareFixture() [Theory] [InlineData(5, 7)] [InlineData(10, 50)] -#if false && !DEBUG - [InlineData(10, 1_000)] +#if !DEBUG [InlineData(100, 100)] + [InlineData(10, 1_000)] [InlineData(1_000, 10)] #endif public async Task MultiThreadedStressTest(int marketCount, int priceCount) diff --git a/src/DynamicData/Cache/Internal/FilterOnObservable.cs b/src/DynamicData/Cache/Internal/FilterOnObservable.cs index 9c07397a7..ec2b77198 100644 --- a/src/DynamicData/Cache/Internal/FilterOnObservable.cs +++ b/src/DynamicData/Cache/Internal/FilterOnObservable.cs @@ -14,23 +14,19 @@ internal sealed class FilterOnObservable(IObservable> _filterFactory = filterFactory ?? throw new ArgumentNullException(nameof(filterFactory)); private readonly IObservable> _source = source ?? throw new ArgumentNullException(nameof(source)); - public IObservable> Run() => _source.Transform((val, key) => new FilterProxy(val, _filterFactory(val, key))) - .AutoRefreshOnObservable(proxy => proxy.FilterObservable, buffer, scheduler) - .Filter(proxy => proxy.PassesFilter) - .Transform(proxy => proxy.Value); - - private sealed class FilterProxy + public IObservable> Run() => + _source + .Transform((val, key) => new FilterProxy(val, _filterFactory(val, key))) + .AutoRefreshOnObservable(proxy => proxy.FilterObservable, buffer, scheduler) + .Filter(proxy => proxy.PassesFilter) + .TransformImmutable(proxy => proxy.Value); + + private sealed class FilterProxy(TObject obj, IObservable observable) { - public FilterProxy(TObject obj, IObservable observable) - { - Value = obj; - FilterObservable = observable.DistinctUntilChanged().Do(filterValue => PassesFilter = filterValue); - } - - public IObservable FilterObservable { get; } - - public TObject Value { get; } + public TObject Value { get; } = obj; public bool PassesFilter { get; private set; } + + public IObservable FilterObservable => observable.DistinctUntilChanged().Do(filterValue => PassesFilter = filterValue); } } diff --git a/src/DynamicData/Cache/Internal/MergeManyCacheChangeSetsSourceCompare.cs b/src/DynamicData/Cache/Internal/MergeManyCacheChangeSetsSourceCompare.cs index c7385735a..2d371ff08 100644 --- a/src/DynamicData/Cache/Internal/MergeManyCacheChangeSetsSourceCompare.cs +++ b/src/DynamicData/Cache/Internal/MergeManyCacheChangeSetsSourceCompare.cs @@ -71,7 +71,7 @@ public IObservable> Run() => Observabl .Subscribe(); return new CompositeDisposable(shared.Connect(), subMergeMany, subParent); - }).Select(changes => changes.Transform(entry => entry.Child)); + }).TransformImmutable(entry => entry.Child); private sealed class ParentChildEntry(TObject parent, TDestination child) {