Hello, I’m running into an issue in React where I do (essentially):
React.S.(value (map f some_signal))
And this blows up because the signal returned by map is not initialized.
In reality, I’m doing ReactiveData.from_signal here, which uses React.S.value.
I saw in the Note repo, in talking about the Pro’s of Note:
Provides (hopefully) a better combinator set. Especially with respect to the pain point of signal initialization in React: in Note, due the pull based strategy, {E,S}.value is safe and sound to use.
What is going on here? Is there a way around it in React?
In my case I tried changing it to ReactiveData.from_signal (React.S.fmap f [] some_signal) which at least avoid the exception, but the list doesn’t seem to change with my signal getting updated (at least in my test case).
What I’ve done, which seems to work is something like:
let (signal, set) = create default_value in
let workaround = map (fun v -> set v) signal in
from_signal @@ map (fun v -> stuff I want to do) signal
Not ideal but the create in the version of React I’m using seems to guarantee there is a value there so it unblocks me until I find a more elegant solution.