Skip to content

Commit 3320590

Browse files
committed
Disable hotreload if not at configuration
1 parent 25e12a0 commit 3320590

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/xiana/hotreload.clj

+11-9
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,19 @@ Accepts the following options:
3939
:restart-fn \"the function to restart the system\" if none 'user/start-dev-system
4040
:tracker {:dirs \"the directories vector list to search for changes\" :reload-compile-errors? \"true\"}."
4141
[cfg]
42-
(let [{:keys [restart-fn tracker]} (:xiana/hotreload cfg {:restart-fn 'user/start-dev-system})
42+
(let [{:keys [restart-fn tracker]} (:xiana/hotreload cfg)
4343
dirs (:dirs tracker ["src"])
4444
retry? (:reload-compile-errors? tracker true)
4545
track-fn (ns-tracker dirs)
4646
reload! (reloader dirs retry?)
47-
restart-fn (resolve restart-fn)]
48-
(go-loop []
49-
(<! (timeout 1000))
50-
(if (track-fn)
51-
(do
52-
(reload!)
53-
(restart-fn))
54-
(recur)))
47+
restart-fn (when restart-fn (resolve restart-fn))]
48+
(when restart-fn
49+
(go-loop []
50+
(<! (timeout 1000))
51+
(println "hotreload!")
52+
(if (track-fn)
53+
(do
54+
(reload!)
55+
(restart-fn))
56+
(recur))))
5557
cfg))

0 commit comments

Comments
 (0)