You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The intent would be that the async implementation would return an empty observable if it wanted to respect a cancel operation.
ExecuteAsync could take a CancellationToken parameter with a default of CancellationToken.None.
The downside would seem to be that this would require every use of this class to include CancellationToken in the async function signature, whether it's used or not. That could be mitigated by adding more of the static method 'constructors' but there's already a ton of them. On the other hand the static methods could keep the current parameters, wrap it to pass to the real class, and anyone wanting to use cancellation support just has to use the real class constructor.
I'd be willing to take a stab at implementing this as long as it's something that you'd have genuine interest in pulling in.
The text was updated successfully, but these errors were encountered:
This actually isn't how Cancellation works in Rx - the way that you implement cancellation is via the implementation of your IObservable; when someone Unsubscribes, you stop doing work. Usually, the easiest way to get this done is via Observable.Create, because it lets you return a Disposable which is disposed on Unsubscribe.
There are also several methods in Rx that "marshal" between TPL Cancellation Zen Nature™ and Rx Cancellation Zen Nature™ - any Rx method that provides CancellationTokens will cancel that token when someone unsubscribes, grep through the source for the symbol NO_TPL to find them. A few off the top of my head are:
Has there been any discussion in the past on integrating CancellationToken support in ReactiveCommand?
Looking at the rxui 6 codebase I'm imagining the constructor parameter changing to:
The intent would be that the async implementation would return an empty observable if it wanted to respect a cancel operation.
ExecuteAsync could take a CancellationToken parameter with a default of CancellationToken.None.
The downside would seem to be that this would require every use of this class to include CancellationToken in the async function signature, whether it's used or not. That could be mitigated by adding more of the static method 'constructors' but there's already a ton of them. On the other hand the static methods could keep the current parameters, wrap it to pass to the real class, and anyone wanting to use cancellation support just has to use the real class constructor.
I'd be willing to take a stab at implementing this as long as it's something that you'd have genuine interest in pulling in.
The text was updated successfully, but these errors were encountered: