bhauman / figwheel-main

Figwheel Main provides tooling for developing ClojureScript applications
https://figwheel.org
Eclipse Public License 1.0
640 stars 93 forks source link

CSS reloaded: off by one by reload cycle #340

Open danielsz opened 1 year ago

danielsz commented 1 year ago

Hi, I would like to start by saying how grateful I am for Figwheel, it is an essential piece of software in the Clojure ecosystem. Thank you!

I'm seeing an interesting anomaly with the CSS reload. It is off by one on my system. Suppose I have the following in my original CSS file:

body {
background: red;
}

I now make a change:

body {
background: blue;
}

The Chrome console prints:

[Figwheel CSS Reload] loaded ["/home/daniel/Clojure/fuji/resources/css/styles.css"] 

However, the page is still red. I go back to the CSS and I modify it again.

body {
background: green;
}

The Chrome console prints:

[Figwheel CSS Reload] loaded ["/home/daniel/Clojure/fuji/resources/css/styles.css"] 

The page is now blue.. Not green as in the saved file. (It will be green on the next reload, with the saved file set to a new value. And so on.)

With each modification, Figwheel appears to do the correct things: The Chrome inspector shows the CSS files with a query param (styles.css?zx=zd2c7uu46kxd), and in the terminal I can see the messages from the Directory Watcher:

21:07:45.121 [ForkJoinPool.commonPool-worker-2] DEBUG io.methvin.watcher.DirectoryWatcher - ENTRY_CREATE [resources/css/.#styles.css]
21:07:45.122 [ForkJoinPool.commonPool-worker-2] DEBUG io.methvin.watcher.DirectoryWatcher - Failed to hash created file [resources/css/.#styles.css]. It may have been deleted.
21:07:45.457 [ForkJoinPool.commonPool-worker-2] DEBUG io.methvin.watcher.DirectoryWatcher - ENTRY_MODIFY [resources/css/styles.css]
21:07:45.457 [ForkJoinPool.commonPool-worker-2] DEBUG io.methvin.watcher.DirectoryWatcher - -> MODIFY [resources/css/styles.css] (isDirectory: false)
21:07:45.471 [ForkJoinPool.commonPool-worker-2] DEBUG io.methvin.watcher.DirectoryWatcher - ENTRY_DELETE [resources/css/.#styles.css]

I'm on Linux: Linux P14S 6.4.12-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 24 Aug 2023 00:38:14 +0000 x86_64 GNU/Linux

I'll be happy to provide more information if needed.