Add advanced observable extension methods#112
Merged
ChrisPulman merged 11 commits intomainfrom Jan 1, 2026
Merged
Conversation
Introduces multiple new extension methods for IObservable<T>, including buffering until idle, conditional scheduler switching, error logging, retry strategies, property observables, throttling, debouncing, async mapping, pairwise emission, and busy-dropping. These additions enhance reactive programming capabilities and provide more flexible stream manipulation options.
Added comprehensive unit tests for new extension methods in ReactiveExtensions, including ThrottleFirst, BufferUntilIdle, DropIfBusy, Pairwise, ScanWithInitial, SampleLatest, SwitchIfEmpty, ThrottleDistinct, ToReadOnlyBehavior, ToHotTask, and ToPropertyObservable. Also refactored the Pairwise implementation to use Zip for improved clarity and correctness.
Removed Ignore attributes from SubscribeSynchronous tests and improved completion waiting logic for reliability. Also fixed SynchronizeSynchronous to correctly forward OnError and OnCompleted events to observers.
glennawatson
approved these changes
Dec 31, 2025
Added documentation and examples for new operators: ThrottleDistinct, ToHotTask, SampleLatest, SwitchIfEmpty, DropIfBusy, BufferUntilIdle, Pairwise, ScanWithInitial, ToReadOnlyBehavior, and ToPropertyObservable. Updated operator tables and changelog to reflect these additions and fixed SynchronizeSynchronous documentation.
Introduces new ObserveOnIf extension methods that accept IObservable<bool> as the condition, allowing dynamic switching of schedulers based on reactive conditions. Corresponding unit tests have been added to verify the new overloads' behavior.
Replaces Thread.Sleep with TestScheduler in BufferUntilIdle_BuffersUntilIdle test for more reliable and deterministic timing. Also adds missing ReactiveUI.Extensions using directive and minor docstring corrections.
The BufferUntilIdle extension method now accepts an optional IScheduler parameter, allowing callers to specify the scheduler used for idle timeouts. This provides greater control over timing and thread context, improving flexibility for different reactive scenarios.
Replaces Task.Delay with TaskCompletionSource in DropIfBusy_DropsWhenBusy test for more deterministic async control. This change improves test reliability by explicitly controlling when the async action completes.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #112 +/- ##
==========================================
- Coverage 80.33% 74.84% -5.50%
==========================================
Files 8 8
Lines 651 791 +140
Branches 64 83 +19
==========================================
+ Hits 523 592 +69
- Misses 104 173 +69
- Partials 24 26 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Introduces unit tests for the ReplayLastOnSubscribe and DebounceUntil extension methods, verifying correct replay and debounce behavior. Also simplifies error handler signatures in existing OnErrorRetry tests.
Introduced a new ThrottleDistinct overload that accepts an IScheduler parameter, allowing for more precise control in reactive scenarios. Updated the corresponding unit test to use TestScheduler instead of Thread.Sleep for improved test reliability.
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
feature
What is the new behavior?
Introduces multiple new extension methods for IObservable, including buffering until idle, conditional scheduler switching, error logging, retry strategies, property observables, throttling, debouncing, async mapping, pairwise emission, and busy-dropping. These additions enhance reactive programming capabilities and provide more flexible stream manipulation options.
Added comprehensive unit tests for new extension methods in ReactiveExtensions, including ThrottleFirst, BufferUntilIdle, DropIfBusy, Pairwise, ScanWithInitial, SampleLatest, SwitchIfEmpty, ThrottleDistinct, ToReadOnlyBehavior, ToHotTask, and ToPropertyObservable. Also refactored the Pairwise implementation to use Zip for improved clarity and correctness.
Removed Ignore attributes from SubscribeSynchronous tests and improved completion waiting logic for reliability. Also fixed SynchronizeSynchronous to correctly forward OnError and OnCompleted events to observers.
Please check if the PR fulfills these requirements
Other information: