Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add advanced observable extension methods#112

Merged
ChrisPulman merged 11 commits intomainfrom
AddExtensions
Jan 1, 2026
Merged

Add advanced observable extension methods#112
ChrisPulman merged 11 commits intomainfrom
AddExtensions

Conversation

@ChrisPulman
Copy link
Member

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

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Other information:

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.
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
Copy link

codecov bot commented Jan 1, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 47 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.84%. Comparing base (5214ef2) to head (a449e31).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/ReactiveUI.Extensions/ReactiveExtensions.cs 66.66% 44 Missing and 3 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.
@ChrisPulman ChrisPulman merged commit bc53bb0 into main Jan 1, 2026
4 of 6 checks passed
@ChrisPulman ChrisPulman deleted the AddExtensions branch January 1, 2026 15:22
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants