ReactiveCommand IsExecuting 在第一个发出值后更改为 false

ReactiveCommand IsExecuting changes to false after first emitted value

我从一个冷的可观察对象创建了一个反应命令。调用命令时,它会将 IsExecuting 更改为 true,并在 first emitted value 从 observable 变回 false。

public class MyViewModel : ReactiveObject
{
    public ReactiveCommand<Unit, long> FooCommand { get; }

    private readonly ObservableAsPropertyHelper<long> _intervals;

    public long Intervals => _intervals.Value;

    public MyViewModel()
    {
        FooCommand = ReactiveCommand.CreateFromObservable(
            () => Observable.Interval(TimeSpan.FromMilliseconds(250))
            .TakeUntil(DateTimeOffset.Now.AddSeconds(2)));
        _intervals = FooCommand.ToProperty(this, vm => vm.Intervals);
    }
}

不应该 IsExecuting 改回 false after observable 完成而不是在第一个发出的项目上?我在这里错过了什么?

请注意,如果绑定会以某种方式影响行为,我会在 XAML 中使用绑定。

正确。当 observable 完成时,IsExecuting 应该变回原样。这是一个错误。

来源: https://github.com/reactiveui/ReactiveUI/issues/1244

应该已修复,但在当前版本 (7.1.0) 中未修复。