Skip to content

Rlist.from_signal can fail if the signal has no value #27

@orbitz

Description

@orbitz

This is a noted aspect of React but it doesn't look like from_signal handles this correctly. Is there a known workaround? I run into this subtle error in code looking roughly like: div @@ Rlist.from_signal @@ React.S.map (..) some_signal.

I was thinking a simple workaround might be below?

  let from_signal ?(eq = (=)) s =
    let f d' d = Patch (D.diff ~eq d d') in
    from_event (try React.S.value s with Failure "signal value undefined yet" -> [] | _ -> assert false) (React.S.diff f s)

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