Closed batwicket closed 9 years ago
The approach with defonce
works fine for the store
component. I don't think it would work more generally as part of the library though. A type of component can currently be instantiated multiple times, but that wouldn't work with ´defonce´ as then state of the first one would also be the state for subsequent instantiations.
After using defonce
as you suggested, I noticed that when editing UI components, the original state was shown until something triggered a state change. I adapted the library itself to now also publish initial states (possibly coming from defonce
) so that UI would show that state after reload from Figwheel. You'll find that in the commit referenced above. Really useful idea, thanks.
I modified Birdwatch to leverage figwheel and it works amazingly well. The only thing I had to change was to define the client-side switchboard as a defonce
and then wrap the messages to the switchboard in an init
function as you suggested, plus add the loader namespace for development using Figwheel and live-reloading. As a result, the application loads on code changes while maintaining the live connection to the Twitter streaming API. Very nice. Thanks for this.
Figwheel is now reacting to changes to the GUI cljs files, but when it does the GUI is completely refreshed and loses the previous state.
Working on it..