so the namespace is (ns example.test-server) the folder is test/cljs/example/test_runner.cljs and the files do not appear to be put in the target folder
fixed it in the end just not 100% sure how one thing I am curious about is do the test files filename matter ? as in do they have to match the namespace in the main app with _test appending or should they be picked up regardless ?
seems when changing a Clojure file it does reload it as documented, but my after-load hook isn't being run. When I change a cljs file it does run. Is there something I can do to have the hook also be triggered when it's a clojure-only change?
reading through the code it seems like this is currently not possible, found a very hacky way around it. Our use case it to have hot reloading of server rendered routes by naively refetching the page and replacing the body
(ns lambdaisland.ui.main
(:require [kitchen-async.promise :as p]))
(defn fetch-and-replace-body! []
(p/let [response (js/fetch (str js/location))
text (.text response)]
(let [parser (js/DOMParser.)
doc (.parseFromString parser text "text/html")
new-body (.querySelector doc "body")]
(set! (.-innerHTML js/document.body)
(.-innerHTML new-body)))))
;; Figwheel hooks don't work here because they only fire when ClojureScript
;; namespaces are reloaded, not when only Clojure namespaces change. Instead
;; hook into the function that schedules the conditional execution of the
;; after-load hook so we get called every time.
(defonce monkey-patch-figwheel
(let [after-reloads js/figwheel.repl.after_reloads]
(set! js/figwheel.repl.after_reloads
(fn [f]
(after-reloads f)
(fetch-and-replace-body!)))))