bhauman / lein-figwheel

Figwheel builds your ClojureScript code and hot loads it into the browser as you are coding!
Eclipse Public License 1.0
2.88k stars 210 forks source link

Figwheel causes clj file reloading #609

Closed edvorg closed 6 years ago

edvorg commented 6 years ago

Hi. I'm using immutant in my web application. Immutant server is wrapped in mount state and is restarted every time clj file is reloaded. I have web app reagent views defined in a few .cljc files. Editing any of those cljc files somehow causes reloading of server namespace and restarting of server. This would be ok if not the fact that server is down at the moment when frontend is trying to load updated js file from server. Tried :reload-clj-files {:clj false :cljc false} but it's not helping.. Could you please recommend a solution for my problem? Thank you.

edvorg commented 6 years ago

My figwheel setup https://github.com/edvorg/jitter/blob/feature/refactor/project.clj

bhauman commented 6 years ago

try :reload-clj-files false

edvorg commented 6 years ago

Unfortunayepy doesn't work either. Currently solved by disabling reloading of server's state on namespace recompilation.

On Tue, Sep 19, 2017, 2:59 AM Bruce Hauman notifications@github.com wrote:

try :reload-clj-files false

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bhauman/lein-figwheel/issues/609#issuecomment-330338726, or mute the thread https://github.com/notifications/unsubscribe-auth/ABbhy60pbe_77rm7MiMH8-ld8qhoyi7pks5sjsuugaJpZM4PbLMw .

-- Best regards, Edward Knyshov.

bhauman commented 6 years ago

So Figwheel probably isn't causing this then.

edvorg commented 6 years ago

The question is why does figwheel reload the namespace? Is it known behavior?

bhauman commented 6 years ago

I am fairly positive that in your case figwheel isn't reloading the namespaces. If :reload-clj-files is false then figwheel isn't reloading clj. That assumes of course that the configuration is in the correct place and that it is making it through whatever process is processing the configuration.

You may want to make sure you aren't using hot loading ring middleware. i.e. ring.middleware.reload

The only way to hot load macros for CLJS consumption is to reload the Clojure namespaces.

edvorg commented 6 years ago

Got it! Thank you for pointing me in the right direction. It was reload middle ware causing the problem.