Fork me on GitHub
Pepijn de Vos12:08:00

I'd swear I saw some reagent page discussing spec, but I can't find it. Seems good to formalize a bit what's in the state atom, but not sure how to do so elegantly without adding a ton of overhead.


Not sure I follow. "What's in the state atom" - what do you mean by that? How r/atom works or what users of Reagent should put in their ratoms?

Pepijn de Vos13:08:55

Well I have a r/atom with a bunch of stuff, and I'd like to formalize a bit what goes where.


What do you mean by "formalize"? Some textual description of what components should store in their state in general, same but for specific components, or maybe something that's checked at run time, maybe something else?

Pepijn de Vos13:08:09

Using clojure.spec


Probably with add-watch then. You'd check all new values against the spec.

Pepijn de Vos13:08:06

I am updating my state on mouse-move though, so it'd add a bunch of overhead. Maybe I'll do that during development and only check in a few key places in production.


You could throttle/debounce the check.

Pepijn de Vos13:08:50

hmmm is there some utility for that? Or it'd be some hack with settimeout or something