Hi there, is there a way to halt and re-init a single component when using integrant.repl?
I have tried with the standard ig/halt! but it seems to stop the whole system...for some reason
Not currently. There is a PR for it, I believe, but it's difficult to implement while maintaining consistency. For example, what if someone runs (init :foo) and then (halt :bar) . It might be reasonable to support keys only on init, and then maintain a set of initiated keys.
(From the https://github.com/weavejester/integrant#initializing-and-halting): Both init and halt! can take a second argument of a collection of keys. If this is supplied, the functions will only initiate or halt the supplied keys (and any referenced keys). For example:
(def system
(ig/init config [:adapter/jetty]))
I’ve never actually used halt! supplying a collection of keys, but I assume it works as advertised.
Well I tried the integrant.repl version (adding an arity, cause missing) but it does not seem to work
I'll have to dig into it and before doing that I was wondering if noone else had a pattern for it
The problem with other approaches is that you'd have to maintain your system and config as var somewhere in the repl, integrant.repl does that for you
I see why now, the original repl code wipes the whole system
https://github.com/arichiardi/integrant-repl/blob/master/src/integrant/repl.clj#L70
Do you have an “expensive” system which is making you want to be able to halt/init just a single component? I was trying to think about why you would want that, because my (entire system) reset’s are very fast so I’ve never had a reason to cherry pick.