Fork me on GitHub
#cljsrn
<
2021-10-29
>
jpmonettas17:10:43

hi everybody! I'm trying to figure out hot reloading in Krell when working with re-frame. Looking at the example the main/init function is executed every time Krell reloads code so I don't know where to dispatch re-frame initial event to set initial state in a way it doesn't smash my state everytime I make a change. Is there something like shadow-cljs :dev/after-load in Krell?

dnolen19:10:33

@jpmonettas you can use defonce it's simple enough, we use re-frame and those dbs are in separate namespaces so generally not reloaded when editing the UI

jpmonettas19:10:59

hmm not following, where should I dispatch my app initialization event? the one that will set up initial state, start setIntervals, connect to sqlite etc? If I do it from main it will happen on every file reload

jpmonettas19:10:11

normally the only thing that happens on reload on my re-frame apps is react component remounting, everything else stays the same