matthiasn / systems-toolbox

Tools and building blocks for building Systems in Clojure and ClojureScript
Eclipse Public License 1.0
174 stars 23 forks source link

the :cmp-state doesn't change when had changed the state-fn and restart! #50

Closed gzll closed 6 years ago

gzll commented 6 years ago

I have a component for datomic db, and when I changed the state-fn of the component, then reload the clj files, and (require '[cmp] :reload), and restart! the switchboard, but when I used the (:cmp-state (:switchboard-cmp-id (:components @(:cmp-state switchboard))))), I get the same thing without change. I just wonder why? Now I must restart the repl to make sure work, when I changed the state-fn.

gzll commented 6 years ago

Update: I have read the wire-or-init-comp fn, and think system-toolbox try keep prev-state, So it is its design national.

matthiasn commented 6 years ago

Hi @gzll, yes it's supposed to work like that, but would it be useful to introduce some way of resetting component states when reloading? I'm open to suggestions there. Cheers