Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:reload-paths equivalent for :auto-refresh? #214

Open
mikew1 opened this issue Aug 25, 2020 · 5 comments
Open

:reload-paths equivalent for :auto-refresh? #214

mikew1 opened this issue Aug 25, 2020 · 5 comments

Comments

@mikew1
Copy link
Contributor

mikew1 commented Aug 25, 2020

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
Copy link
Contributor Author

mikew1 commented Aug 25, 2020

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
Copy link
Contributor Author

mikew1 commented Aug 25, 2020

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?

@weavejester
Copy link
Owner

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

@mikew1
Copy link
Contributor Author

mikew1 commented Aug 26, 2020

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

@weavejester
Copy link
Owner

Yes please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants