Skip to content

Cannot pass rx.cond(...) as an event trigger that returns either an EventSpec or an arbitrary FunctionVar #6204

@masenf

Description

@masenf

When we have an rx.cond that returns heterogenous values (either FunctionVar or EventVar), then that gets rejected by the new lambda return type checking logic. Idk if we want to allow that to return any arbitrary var, or if requiring the user to say rx.cond(...).to(rx.event.EventVar) is good enough for now. I'm probably more inclined to the latter.

I think we have some special logic somewhere that is treating the rx.cond case specially. Even with the explicit cast to EventVar, i'm not able to get it to work because it wants to treat the whole thing as an EventVar (and thus wrap it in addEvents), which just doesn't work if one of the branches of the rx.cond is not a real EventSpec.

I think we can just defer on this problem for now; it wasn't working before and still doesn't work now. We could improve it in the future.

Originally posted by @masenf in #6188 (comment)

See original PR for more context and sample code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions