This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # beginners (45)
- # boot (2)
- # cider (2)
- # cljs-experience (1)
- # cljsrn (6)
- # clojure (67)
- # clojure-brasil (1)
- # clojure-dusseldorf (47)
- # clojure-finland (7)
- # clojure-italy (81)
- # clojure-portugal (2)
- # clojure-russia (12)
- # clojure-sanfrancisco (1)
- # clojure-serbia (1)
- # clojure-spec (22)
- # clojure-uk (27)
- # clojurescript (49)
- # clojurewerkz (3)
- # code-reviews (3)
- # component (19)
- # core-async (3)
- # cursive (16)
- # events (7)
- # fulcro (20)
- # graphql (7)
- # immutant (1)
- # jobs (2)
- # juxt (44)
- # leiningen (7)
- # lumo (35)
- # onyx (31)
- # portkey (31)
- # portland-or (8)
- # random (1)
- # re-frame (82)
- # reagent (35)
- # sfcljs (1)
- # spacemacs (5)
- # specter (7)
- # unrepl (4)
- # yada (2)
I'm currently learning to work with component, please excuse me if this is a n00b question.
resume on the repl in the user namespace works.
However, if I hit
C-c C-x (that is cider-refresh) I don't get an error message, but jetty isn't reachable afterwards, even though the port is still blocked.
(start) afterwards manually doesn't seem to affect any components any more.
Here is the
*Messages* output for the command:
The only way I have managed to get back into a working state is by restarting the JVM. How can I debug what is going wrong?
cider-refresh: Calling reloaded.repl/suspend cider-refresh: Successfully called reloaded.repl/suspend cider-refresh: Reloading (re-frame.db re-frame.loggers re-frame.registrar re-frame.interceptor re-frame.cofx re-frame.utils re-frame.trace re-frame.subs re-frame.std-interceptors re-frame.events re-frame.router re-frame.fx re-frame.core com.stuartsierra.dependency example.config com.stuartsierra.component example.routes example.application example.example-test example.common user example.common-test) cider-refresh: Reloading successful cider-refresh: Calling reloaded.repl/resume cider-refresh: Successfully called reloaded.repl/resume
Following the steps that reset does manually also works:
(reloaded.repl/suspend) (clojure.tools.namespace.repl/refresh :after `reloaded.repl/resume)
@vinai likely refresh is destroying the var that contained the server, the only safe option is to make sure you stop the component before reloading the code
I don’t know cider very well, but I’d imagine it provides some customization for hooks to call before reloading?
Thanks for responding @noisesmith. The customization hook runs
reloaded.repl/suspend before and
if you put the component in a top level binding, refresh (or even reload if you don’t use defonce) will destroy the accessible binding and you won’t be able to access it to stop it after that point
suspend and resume seems to do the same as stop and start for most components. If I call it manually suspend calls .stop on the jetty instance var.
I don't know elisp but from what I can tell all it should do is run refresh or refresh-all in between suspend and resume. However, when I do that manually all is okay.
oh, OK - if you are losing access to a running component, it’s not doing that process properly, I was suspicious of suspend and resume because I know that stop and start work, and haven’t used suspend and resume
Currently I'm just invoking reset when I need to manually, but it would be nice to have the keyboard shortcut working... Here are the docs:
(cider-refresh &optional MODE) Reload modified and unloaded namespaces on the classpath. With a single prefix argument, or if MODE is `refresh-all', reload all namespaces on the classpath unconditionally. With a double prefix argument, or if MODE is `clear', clear the state of the namespace tracker before reloading. This is useful for recovering from some classes of error (for example, those caused by circular dependencies) that a normal reload would not otherwise recover from. The trade-off of clearing is that stale code from any deleted files may not be completely unloaded.
The elisp code in question is
So it really only seems to send the op nrepl message refresh-all or refresh.
`("op" ,(if refresh-all? "refresh-all" "refresh") "print-length" ,cider-stacktrace-print-length "print-level" ,cider-stacktrace-print-level)