This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-04-05
Channels
- # announcements (7)
- # beginners (10)
- # calva (14)
- # clj-otel (8)
- # clojure (42)
- # clojure-europe (20)
- # clojure-nl (1)
- # clojure-norway (22)
- # clojure-spec (8)
- # clojure-uk (7)
- # core-async (10)
- # cursive (1)
- # events (1)
- # hyperfiddle (20)
- # introduce-yourself (1)
- # jobs-discuss (11)
- # lsp (48)
- # missionary (3)
- # music (1)
- # off-topic (7)
- # overtone (9)
- # pedestal (21)
- # rdf (1)
- # releases (3)
- # shadow-cljs (22)
- # specter (13)
- # squint (1)
- # yamlscript (3)
Is there some depth limit to what gets hot-reloaded?
I'm still trying to isolate the problem but it looks like my views (using re-frame) do not get reloaded if I make changes in something that's 3 steps removed (as nested :require
) from my entry point. Adding an import at top level fixes the issue but it doesn't look right to me.
I'm already using :reload-strategy :full
https://code.thheller.com/blog/shadow-cljs/2019/08/25/hot-reload-in-clojurescript.html
:reload-strategy
does not affect what gets compiled, so if you are relying on some macro stuff changing that might be the reason?
are you using react 18? in reagent (and thus re-frame) there is this issue https://github.com/reagent-project/reagent/issues/579. I have encountered it a few times myself.
(defn ^:dev/after-load start []
;; dummy prop that always changes
(reagent/render [ui {:x (js/Date.now)}] dom-root))
Thanks both! After some more investigation is not the simple importing I described. If I just renderer the view hot-reload works correctly. The problem is with the way I set up reitit routing, probably wrongly. The routes list contains refs to the views and I render them from the router. I think that becomes stale in some way that I have yet to debug.
Hello @U47V0EZF1 I am facing exactly the same issue you are describing, and after testing different variants, I found that this way hot-reload works again, very ugly though
(def routes
["/" {:name ::home
:view (fn []
[home-page])}])
https://github.com/guillerglez88/hl7v2-lab/blob/master/src/hl7v2_lab/core.cljs
if you find a solution for this, please, @menction me to be aware.that is precisely the first thing listed under things to avoid. https://code.thheller.com/blog/shadow-cljs/2019/08/25/hot-reload-in-clojurescript.html#things-to-avoid
and that is the correct and only workaround. shadow-cljs cannot update functions you put into a map in some place. creating an extra functions delays the lookup of the actual function until needed, so it always gets the latest hot-reloaded version.
well I shouldn't say it is the only workaround. frankly the routing data should only consist of data, never functions. then in the place that is actually using it use that data
something like
(defn app []
(let [view (get-in @route-match [:data :view])]
(case view
:home [home-page]
[not-found])))
(def routes
["/" {:name ::home
:view :home}])
oh, I see! thank you @U05224H0W , I will use a keyword instead of a function as you suggested.
will what work? its a symbol. yes you can use symbols. if you expect that to magically call the function then no, that will not work.
thank you for your support @U05224H0W!