-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add Functions to handle Cancellation Token Tasks for ReactiveCommand #3479
Conversation
Issue with HandleNonSuccessAndDebuggerNotification needs resolving
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #3479 +/- ##
==========================================
+ Coverage 64.57% 65.41% +0.84%
==========================================
Files 156 159 +3
Lines 5702 5876 +174
==========================================
+ Hits 3682 3844 +162
- Misses 2020 2032 +12
... and 6 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
Add Tests for new functions Add ReactiveCommand.CreateFromTask tests
Add missing tests for CreateFromTask<Tin, TOut> overload from last commit
Converting to draft until we decide if we want to introduce the concept of Signal |
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. |
What kind of change does this PR introduce?
Fix for #2716
Fix for #1245
Fix for #2153
Fix for #3450
What is the current behaviour?
ReactiveCommand does not properly support Cancellation tokens properly for CreateFromTask due to an underlying issue in System.Reactive
What is the new behaviour?
Fix the issues with the base functions within RxUI due to and issue with Observable.FromAsync from System.Reactive by using a new Signal.FromTask as the new base, this uses a AnyncSignal base to do the handling exposing the interface IAnyncSignal which inherits from IObservable.
Signal.FromTask can be used to transform a Cancellation Task into an Observable producing the expected cancellation, errors and results.
What might this PR break?
ReactiveCommand.CreateFromTask with a cancellation token will operate differently
It will have a CancellationTokenSource passed to allow conditional user cancellation instead of a CancellationToken
All overloads will require a return value of Unit or TResult
Cancellation can be done through disposal of the Execute Observable or of the ReactiveCommand to ensure that long running Tasks are not left in limbo.
Ensure that the CancellationToken is passed to all Tasks that are executed in the command execution
Check for CancellationToken.IsCancellationRequested before starting another Task during the overall execution to ensure that you don't use a disposed Token.
Please check if the PR fulfils these requirements
Other information: