Fork me on GitHub
#cljsrn
<
2021-06-16
>
dnolen16:06:27

@michael.w.jung this sounds strange to me - never seen issues with hot reloading

dnolen16:06:24

but you wouldn't combine w/ Figwheel - you would just use Figwheel and/or shadow-cljs if they seem to work better for you

dnolen17:06:44

(but still I suspect any hot-reloading issues you believe to exist would probably exist elsewhere)

dnolen17:06:57

it would be useful for you to elaborate a situation where it doesn't work

dnolen17:06:19

because the ns is definitely getting reloaded - but perhaps the way you have structured your code it only appears to not work

Michael Jung17:06:36

Yes, maybe I simply use it incorrectly. I have to say that I don’t yet fully understand how reloading works. My main function looks like this:

(defn ^:export -main [& args]
  (dispatch-sync [:initialize-db])
  (load-db-from-storage)
  (r/as-element [app-root]))
Maybe that is already problematic? Will the main function be called again on a reload? Should I rather do the initialization in a defonce expression?

Michael Jung17:06:40

I also suspect that my use of react navigation might interfere with hot reloading. For example: if I change something on one screen, I always have to go up one level and come back to the screen to see the effect.

Michael Jung18:06:10

Ok, it seems to me like -main is called again after a reload, because I can see its effects.

dnolen18:06:59

FWIW I don't believe in JS routers

yes 2
dnolen18:06:07

we just use core.match and move on

Michael Jung18:06:38

Could you elaborate on that a little? I’m not sure how an alternative would look like and how I’d get nice transitions between screens in that case.

dnolen19:06:32

oh you want the native transitions - but that alone might be futzing w/ hot-reloading

dnolen19:06:46

I don't know how react navigation works

dnolen19:06:57

I suspect whatever you are seeing you will see elsewhere

dnolen19:06:22

would need to look at the details of react navigation but don't have the time for that at the moment

Michael Jung20:06:46

No no, I don’t want you doing research to solve my problems. Native transitions would be nice. But they aren’t a must for me. I’d be interested in how your solution looks like. Do you simply have a conditional in your root component that will show the proper subcomponent depending on your application state?