kit-clj / kit

Lightweight, modular framework for scalable web development in Clojure
https://kit-clj.github.io/
MIT License
463 stars 43 forks source link

Refrain from re-initializing query-fn if queries files not modified #122

Closed gerdint closed 6 months ago

gerdint commented 6 months ago

Perhaps this is overkill, but since a lot of your components will probably depend on the :db.sql/query-fn component the fact that it was not resumable caused pretty much all components to be reloaded when doing (reset).

This PR adds an explicit check if any of the hugsql queries files are modified, and if not the old implementation is returned upon resume.

Requires Java 7+ since java.nio.file APIs are used for getting the modification time. (java.io.File#lastModified unfortunately always seem to return 0, at least on macOS).

yogthos commented 6 months ago

I think this is a good idea, it's a nice quality of life improvement for the development experience. 👍

gerdint commented 6 months ago

Cool!