Fork me on GitHub
#shadow-cljs
<
2022-09-30
>
andrzejsliwa14:09:14

I did, but this is not explaining the interactions between reitit and reloading.

thheller15:09:31

it probably is. see the gotchas?

thheller15:09:01

most likely you are keeping some reitit state in your app db. ie. a render function, this function is not updated on hot-reload and as such you don't see any changes?

thheller15:09:30

if you want to share some code I can probably point you to it

thheller15:09:34

otherwise I'm just guessing

andrzejsliwa18:09:16

here is my example:

andrzejsliwa18:09:07

no matter if I define match state as defonce or def

andrzejsliwa18:09:55

where I’m changing some style in “interactive” view, changes are not reloaded, until I refresh browser manually

andrzejsliwa18:09:52

you can change class of color

andrzejsliwa18:09:41

when I’m rendering interactive component as root, everything working like expected, but when router is involved it’s not refreshing

andrzejsliwa18:09:29

you can also change the text in href or header

andrzejsliwa18:09:13

ok, I found it, the problem was that (router-start!) was in

(defn ^:export init
  []
  (router-start!)
  (start))

andrzejsliwa18:09:48

when I move it to

(defn ^:dev/after-load start
  []
  (router-start!)
  (d/render
   [current-page]
   (.getElementById js/document "app")))

andrzejsliwa18:09:53

then it’s working

andrzejsliwa18:09:32

thx @U05224H0W for pushing me in a good direction.

thheller19:09:35

that is precisely the mentioned "Holding Code references in State" gotcha

thheller19:09:04

you are putting function into a map, those functions are not updated by hot-reload

thheller19:09:28

so you see old code, unless you re-create this map (which I assume the router-start! does

andrzejsliwa08:09:14

I wonder if anyone here had a similar issue and knows how to force the update of react component rendered behind routing. (on changing file via shadow watch)