Beginner Questions: hot loading, objects, chestnut, cursive, etc

I just want a place to store questions about clojurescript I run into and maybe find answers to later (to help other newbies). Any help in answering these questions is 110% welcome.

(T)itle: Escaping from a REPL crash?
(Q)uestion: When I get an error inside a #object the (figwheel.main) REPL crashes and no command seems to escape, so I have to restart the terminal. Is there another way?
(N)otes: Ctrl + C and Ctrl + D do not work.
(A)nswer: ?

(T): Running Chestnut in Cursive
(Q): Has anyone tried setting up a chestnut template in Cursive? It seems like the way IDEA auto saves causes the hot loader to not recognize the changes being made; preventing it loading those changes in the browser.

(T): Understanding the #object data type
(Q): Is there anywhere online I can learn more about this data type? My best guess it that this is a generic javascript object, which I don’t know much about. Further, I’m not sure how to work with #object outside the cheatsheet. The data structures page didn’t seem to have much.

1 Like

Hi @AlbertSnows, welcome to ClojureVerse!

I think you’ll have more luck making a separate post for each question you have, either in #community-center:beginners or in #questions-help:how-to. Try to put in enough relevant information, like what’s your environment, what documentation are you consulting, expected vs observed behavior.

If you get an error message then make sure to copy-paste the actual message, including any output that came before it. If it’s too much to conveniently put in a post then you can put it in a gist.

(T): Running Chestnut in Cursive
(A): Chestnut uses figwheel so it’s more a question of getting these two to work together.
Worst case, using the terminal should work fine.
If you want to use the provided repl to actually take advantage of cursive then make sure you import/make your project correctly with Leiningen.
Cursive & Leiningen:
https://cursive-ide.com/userguide/leiningen.html
Make a local repl also using Lein (profiles: base, dev ?).
Chestnut in particular seems to take a long time to start up. If you run into errors when starting up the repl then you may need to increase the REPL startup timeout in settings.
Hopefully that gets the repl running.
At this point hotloading is hit or miss, but it should work theoretically. If the cljs icon in the bottom left shows up then that’s probably a good sign. For me, reloading the page seems to get hotloading to work again.
Oh and maybe some helpful links:


1 Like

FYI on hotloading to browser via chestnut in cursive, if the page isn’t loading try doing a hard refresh to get the js to update so you can actually see your changes in the browser.

(T): clojure.main
(Q): What is clojure.main?
(A): see https://clojure.org/reference/repl_and_main
(N): On windows, make sure your command is recognized when you type “clojure” or “clj” or something. Otherwise you wont be able to work with clojure since you don’t have it installed (or at least, not installed properly).

(T): Starting the f[quote=“AlbertSnows, post:6, topic:5031, full:true”]
(T): Starting the fulcro template
(Q): How do I get a running instance of the fulcro template?
(A): You’ll need 3 terminals (technically 2 + cursive nrepl in intellij)
Terminal 1: run “npx shadow-cljs server” in a terminal.
Then, go start a watch on main at 9630 in localhost.
Step 2: set up a remote nrepl server.
I use cursive in intellij. The host is localhost, port is 9000, context module is fulcro app.
Terminal 3: run -A:dev -J-Dtrace -J-Dghostwheel.enabled=true in a separate third terminal. Quote the last part if you’re in powershell and it doesn’t work. e.g. “-J-Dtrace -J-Dghostwheel.enabled=true”
Then, hopefully, it should show stuff if you go to 3000 localhost.
(please be sure to follow their guide, this is a quick summary for getting it working on windows, but skips a bunch of stuff that may cause these instructions to not work for you)
(N):
fulcro template: https://github.com/fulcrologic/fulcro-template
fulcro book: http://book.fulcrologic.com
shadow-cljs book: https://shadow-cljs.github.io/docs/UsersGuide.html

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.