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

using figwheel #10

Closed batwicket closed 9 years ago

batwicket commented 9 years ago

I would like to use figwheel with the example. Any suggestions would be appreciated.

batwicket commented 9 years ago

Just starting out, but live development might be a big win for the toolbox. From http://blog.michielborkent.nl/blog/2014/09/25/figwheel-keep-Om-turning/, it also seems like hot code reload is a requirement that might cause subtle issues. Digging into it, but i'm new at this..

batwicket commented 9 years ago

I've got figwheel integrated, but still some, not unexpected, issues. Mostly changes to the example project.clj and addition of some client-side code.

matthiasn commented 9 years ago

Nice, I'll be back from vacation tomorrow, looking forward to using figwheel with the library. Thanks :-)

batwicket commented 9 years ago

added a pull request..

batwicket commented 9 years ago

I'm looking at how to handle preservation of state across changes.

The standard www examples hold the app state centrally in a def and simply replace it with a defonce.

If i understand it correctly, each component sets its :state-fn to a function, typically mk-state, which returns an initialized atom to comp/make-component. The state is in a local variable which i think is re-initialized each time so this does not work.

If it was in a defonce local to the namespace and resolve was used to ensure it was only initialized once in mk-state perhaps it is ok.. just checking. I can submit another pull request if this approach is ok.