Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
orbitz opened this issue Oct 27, 2021 · 0 comments
Open

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

orbitz opened this issue Oct 27, 2021 · 0 comments

Comments

@orbitz
Copy link

orbitz commented Oct 27, 2021

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant