-
-
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
Feature ReactiveCommand.CreateRunInBackground #3501
Feature ReactiveCommand.CreateRunInBackground #3501
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #3501 +/- ##
==========================================
+ Coverage 63.60% 63.91% +0.30%
==========================================
Files 157 157
Lines 5768 5783 +15
==========================================
+ Hits 3669 3696 +27
+ Misses 2099 2087 -12
☔ View full report in Codecov by Sentry. |
Can we change the new flag to be not a optional parameter. Optional parameter are a breaking API and can break with certain tools, while a method overload is not. |
revert version due to extending API instead of changing
I have a few questions about this PR, I think we could maybe simplify this implementation quite a bit and make its intent a bit more clear
Also, I think we can really simplify its implementation, as just a simple proxy to public static ReactiveUI.ReactiveCommand<TParam, TResult> CreateRunInBackground<TParam, TResult>(
Func<TParam, TResult> execute,
IObservable<bool>? canExecute = null,
// Rather than "runAsync", always provide a way to control concurrency via an IScheduler
IScheduler? backgroundScheduler? = null,
IScheduler? outputScheduler = null) {
return ReactiveCommand.CreateFromObservable(
Observable.Start(execute, backgroundScheduler ?? RxApp.TaskPoolScheduler), canExecute, outputScheduler);
} Thoughts? |
Thanks Ani, I will update this evening to realign to these thoughts and test to ensure the result is as desired. |
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?
Feature for ReactiveCommand
What is the current behaviour?
ReactiveCommand.Create runs Synchronously
ReactiveCommand.CreateFromTask runs Asynchronously
ReactiveCommand.CreateFromObservable runs Asynchronously
What is the new behaviour?
To give the option for all Creation options to operate in the same way a new method CreateRunInBackground has been added to the ReactiveCommand creation options making:
ReactiveCommand.Create runs Synchronously
ReactiveCommand.CreateRunInBackground runs a Method Asynchronously
ReactiveCommand.CreateFromTask runs a Task Asynchronously
ReactiveCommand.CreateFromObservable runs a Observable Asynchronously
What might this PR break?
None expected as existing functionality is default
Please check if the PR fulfils these requirements
Other information: