Skip to content

[Bug]: ReactiveCommand Observable does not propagate results #3942

Open
@Micha-kun

Description

@Micha-kun

Describe the bug 🐞

I don't know if it's a bug or something I'm doing wrong...

I have a ReactiveCommand that returns an IEnumerable and I'm trying to chain those results to another pipeline, like in this code example:

this.WhenActivated(
    d =>
    {
       this.GetDataCommand.Do(_ => { }).Subscribe().DisposeWith(d);
       this.GetDataCommand.Execute().Subscribe().DisposeWith(d);
    });

....

[ReactiveCommand]
private Task<IEnumerable> GetData(CancellationToken ct){
     return Task.FromResult([]);
}

The GetDataCommand RC is a Task method with Unit as Input and IEnumerable as Output. this.GetDataCommand.Execute() really executes succesfully, but, unexpectedly, the Do method attached before to the command never executes after. I tried to wrap command inside this.WhenAnyObservable() without exit. What I'm doing wrong? At first I thought it was because I was using ReactiveUI.SourceGenerators, but I tried with plain ReactiveCommands with the same results. I tried removing those DisposeWith(d) too and nothing changed.

My app is a Winforms app in .Net 8. ViewModel is in a Class Library only for ViewModels.

Step to reproduce

1 - Test my sample.

Reproduction repository

https://github.com/reactiveui/ReactiveUI

Expected behavior

Do/Select/Subscribe code executing

Screenshots 🖼️

No response

IDE

Visual Studio 2022

Operating system

Windows

Version

11

Device

PC

ReactiveUI Version

20.1.63

Additional information ℹ️

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions