Search code examples
clojurescriptleiningenfigwheel

Invalidate all cache with lein figwheel


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?


Solution

  • 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.