3

I've run into several problems with Fighweel's hot code reloading when it doesn't reload everything it has to reload and old state/code persists even if it's no longer in the source code and even if I re-run lein figwheel.

What is the easiest way to clear all browser cache, all figwheel cache and all-the-rest-of-the-cache-I-might-not-even-know-about to make sure there are no leftovers from the old version of the code?

Chris Murphy
  • 6,020
  • 1
  • 19
  • 36
0x60
  • 2,628
  • 1
  • 13
  • 16

2 Answers2

2

Update 2: I noticed some more caching issues so I created bhauman/lein-figwheel#667 to hopefully squash them once and for all. These changes should be released in Figwheel 0.5.16. I also wrote more about how to serve ClojureScript files in development.

Update: bhauman/lein-figwheel#586 has been merged which sets the correct caching headers to avoid stale files being used. You should no longer see any issues with stale files when using lein-figwheel version 0.5.12 or later.


In Chrome on macOS, Command+Shift+R does a hard reload, or you can long click on the reload button to get an option to clear the cache. Make sure that you've got Chrome devtools open, or you won't get the options.

Chrome reload menu from long click

As a side note, I think the caching behaviour you are seeing might be fixed by bhauman/lein-figwheel#464.

Daniel Compton
  • 11,420
  • 4
  • 33
  • 55
1

In Chrome Cntl-F5 should reload the page, which often needs to be done. Best to set the browser so that no cache is used while the console is open, and always be developing with the console open. See this answer: Disabling Chrome cache for website development.

When things are really confused from the command line go lein clean. You shouldn't need to do this very often. What exactly gets cleaned (deleted from disk) depends on what is in the project.clj for the key :clean-targets.

Chris Murphy
  • 6,020
  • 1
  • 19
  • 36