ml-in-barcelona / jsoo-react

js_of_ocaml bindings for ReactJS. Based on ReasonReact.
https://ml-in-barcelona.github.io/jsoo-react
MIT License
138 stars 19 forks source link

Hooks that watch values use inconvenient equality semantics #153

Closed glennsl closed 2 years ago

glennsl commented 2 years ago

Hooks that watch values for triggering updates, such as useEffectN, useMemoN etc., use the equality semantics of JavaScript instead of OCaml. And since OCaml values are often "block" values, represented as arrays in JavaScript, this will almost always be reference equality, and almost never what you want. The only values that would conform to expectations, I think, are ints, floats and bools.

We ought to look into how we can offer the equality semantics users expect.

jchavarri commented 2 years ago

@glennsl I consider this fixed by #154, please reopen if that's not the case.

Thanks for your work on this! 🎉