Currently evalOnSave uses nrepl load-file to evaluate a single file to the repl. This works in many cases, but there are some issues with this:
Some changes require multiple namespaces to be reloaded in order. For example, evaluating a namespace that defines a protocol will require all namespaces implementing that protocol to also be re-evaluated after the protocol namespace is evaluated. Currently you'd either have to reload the entire repl or evaluate affected namespaces manually.
Old vars/funcs that were removed still exist in the REPL, sometimes leading to hard to catch issues. For example, if you remove a test case from a namespace and execute the test runner for that namespace, the removed test is run.
Proposal
Use clojure.tools.namespace.repl to evaluate modified namespaces based on the dependency graph. Supposedly cider-ns-refresh can be used here.
I'm personally not as familiar with the clojure.tools.namespace.repl lib as we're using weavejester/ns-tracker but the idea seems the same.
Currently
evalOnSave
uses nreplload-file
to evaluate a single file to the repl. This works in many cases, but there are some issues with this:Proposal
Use
clojure.tools.namespace.repl
to evaluate modified namespaces based on the dependency graph. Supposedlycider-ns-refresh
can be used here.I'm personally not as familiar with the
clojure.tools.namespace.repl
lib as we're usingweavejester/ns-tracker
but the idea seems the same.Related Reading:
https://practicalli.github.io/spacemacs/clojure-repl/refresh-restart-repl.html#issues-with-clojure-reload