I have been using Clojure, ClojureScript, lein, shadow-cljs, Emacs, and CIDER to work on a Clojure/ClojureScript dynamic web app project.
Usually, I build the project executing command cider-jack-in-cljs
in Emacs, I choose shadow-cljs
, then shadow
for REPL type, and app
for build option.
It works fine. I can watch changes on the UI on localhost:3005
.
However, quite often the following happens:
Apparently, this phenomenon (not sure about the technical name) happens after some period of inactivity.
If I try something in the REPL, I get:
cljs.user> net-income
No available JS runtime.
See https://shadow-cljs.github.io/docs/UsersGuide.html#repl-troubleshootingnil
To make it work again, I need to refresh the browser. This is a little painful.
After refreshing the browser, the UI is back. However, I need to re-eval all variables previously defined in the REPL. This is big time painful.
For instance, if I did:
cljs.user> (def accounts @(re-frame.core/subscribe [:the-accounts sel]))
The "browser crash" which is caused by inactivity will erase all previous definitions.
1 - Is there some way to expand the time necessary for the browser to crash?
2 - Or, alternatively, is there a way to retrieve my previous variable definitions on the REPL without the need to re-eval one by one?
Obs.: in the same session, the REPL history works. I have the history, I just do not have the values inside the running lisp image.