lein-ring icon indicating copy to clipboard operation
lein-ring copied to clipboard

:reload-paths equivalent for :auto-refresh?

Open mikew1 opened this issue 5 years ago • 5 comments

I've been using lein ring serve with :auto-reload? and auto-refresh? both true which have been working great.

I've now added figwheel to start to add javascript, this tool pushing changes into the browser directly. This of course doesn't require a reload or refresh on the part of the server, i.e. lein ring needn't (shouldn't!) be involved at all in this.

I note that :reload-paths applies to :auto-reload (i.e. the server state), and it seems not to :auto-refresh (browser refresh).

Is there a way to limit which paths trigger :auto-refresh? I'd like to exclude the location where I have cljs files from triggering that.

mikew1 avatar Aug 25 '20 19:08 mikew1

I thought I might be able to restrict :auto-refresh by moving the file I don't want to trigger it (the .cljs file) to a location not included in leningen :source-paths, but that hasn't worked, it's still triggering a refresh.

mikew1 avatar Aug 25 '20 21:08 mikew1

I've made some progress on this - by adding ring-refresh explicitly, rather than relying on it being added by :auto-refresh, and specifying only "src". With this setup, figwheel injects smoothly into the page served by jetty without a refresh. However, when I edit a file in src (a server rendered hiccup page) the page itself reloads fine as normal, but the moment it loads and the react component mounts, a second reload is immediately triggered. Any idea why?

mikew1 avatar Aug 25 '20 22:08 mikew1

You can customize these by adding :reload-paths and :refresh-paths to the :ring options in your project.clj file.

weavejester avatar Aug 26 '20 15:08 weavejester

Thanks so much - so simple. :) Would you like a pull request to document this in web server options?

mikew1 avatar Aug 26 '20 15:08 mikew1

Yes please.

weavejester avatar Aug 26 '20 16:08 weavejester