evaling (refresh :after 'user/go) in user ns at repl does not reload user, and runs old/unchanged code.
intronic opened this issue · comments
Hi,
As far as I can tell I'm folliwing the component reloading setup described (https://github.com/stuartsierra/component#reloading).
I make changes to application/component code, save the files, then in the user ns i eval (reset) which does the stop & refresh, which shows the files I changed reloaded (all are reloaded, 'user' ns is not), and then calls 'user/go which creates a system object and starts it.
The problem is that it is started using the old version of the start code that was refered to the last time the user ns was loaded.
To fix this I have to either eval : (require 'user :reload), or touch the user.clj file to trigger this to be reloaded and pick up the new code in the other namespaces.
I cant figure out why my repl user ns does not use the new reloaded functions from my other namespaces - why the repl in user ns has old references?
I assume i've missed somethnig simple but cant see what.
Any advice appreciated.
A few possibilities come to mind:
- Your user.clj file is in a directory not searched by tools.namespace for reloading. Check that
@#'clojure.tools.namespace.repl/refresh-dirs
includes the directory containing user.clj. - Your user namespace does not
:require
your application code in itsns
declaration, which is necessary for tools.namespace to know that it needs to be reloaded. - Your
reset
function callsgo
as a normal function, not using the special:after
option torefresh
, which is necessary to see the new code.