ocsigen / ocsigen/reactiveData
Rlist.from_signal can fail if the signal has no value
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 52
- Forks
- 10
- Avg merge
- 4m
- Merged PRs (30d)
- 1
Description
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)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing Rlist.from_signal and the React.S.value and React.S.diff calls mentioned in the issue. Reproduce the failure with a signal that has no value, then compare the observed behavior with the proposed exception handling. Done means establishing and verifying the expected behavior for an undefined initial signal value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml, react
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100