-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
Describe the bug
According to this documentation comment, ReactiveCommand Execute() should not run the associated command logic until the returned observable is subscribed.
"Invoking this method will return a cold (lazy) observable that, when subscribed, will execute the logic encapsulated by the command. It is worth restating that the returned observable is lazy. Nothing will happen if you call Execute and neglect to subscribe (directly or indirectly) to the returned observable."
| /// Invoking this method will return a cold (lazy) observable that, when subscribed, will execute the logic |
However, this change replaced the call to
Observable.StartAsync(execute)
with
() => execute().ToObservable(),
which incorrectly executes the command logic immediately.
Steps To Reproduce
- Call ReactiveCommand.Execute()
Expected behavior
- The logic in the command should not be executed (until .Subscribe() or await is used)