so, rum/local
is exactly a clojurescript atom that you mix in, since it needs to generate for local scope on will-mount
. I reckon the rule should be consistent: if you want your component to react to any state change, use rum/react
- just a deref should always be assumed to be wrong (unless you specifically don't care about the reaction/update, that is)
passing around atoms and cursors, in my experience of rum at least, is completely normal and useful - but that's not really the point here. I'm more saying that the default behaviour of rum/local
mixing in an implicit rum/reactive
and rum/react
for its atom can be unexpected.. - of course, I've worked around it by implementing my own simplified version of rum/local
which we'll be using ubiquitously, but I mention it here as something for people to be aware of.
If you look at https://github.com/tonsky/rum/blob/gh-pages/src/rum/core.cljs#L335
It seems to indicate that deref
ing a rum/local
state is fine in the docstring, and that rum/react
is intended to be used with rum/reactive
and for rum/react https://github.com/tonsky/rum/blob/gh-pages/src/rum/core.cljs#L407
https://github.com/tonsky/rum/blob/gh-pages/src/rum/core.cljs#L409
yes - I'm saying that the current implementation of rum/local
is unexpected. it "works" to just deref, but it's treated as not only a local atom, but also an implicit local rum/reactive
- see the duplication: https://github.com/tonsky/rum/blob/gh-pages/src/rum/core.cljs#L353 and https://github.com/tonsky/rum/blob/gh-pages/src/rum/core.cljs#L394 - imo, the rum/local
's single job should be to provide a local component scoped atom that you can change. Its job should not be to also rerender the component if the atom changes.