Fork me on GitHub
#clojurescript
<
2021-04-03
>
Adam Helins12:04:16

Do you ever get out of memory exceptions when running generative tests on node? I am noticing more and more that a generative test than is quite all right on the JVM (eg. runs in 20 seconds without any memory adjustment) becomes really bloated when run on node (eg. now takes several minutes and explicitly needs more memory with --max_old_space_size)

indy15:04:13

Which version of node are you using? Node 14 solved some memory issues we had

zackteo13:04:51

@nilern @thheller Hello šŸ™‚ I went through quickstart guide - https://github.com/thheller/shadow-cljs#quick-start as mentioned. But admittedly I am not too sure where I should continue from there šŸ˜…, do y'all have any suggestions? If not no worries, I'll try to figure something out!

thheller13:04:29

what in particular are you looking to do? I mean did you chose a libray/framework yet or do you just want to test a few things?

zackteo14:04:54

Hmmm, I have a good idea of what libraries I am planning to use already. Have been thinking reagent with re-frame for stability (building a final year project for a company) and most examples/references. I considered rum after looking at it for awhile but seems like both are similarly stable and it wouldn't make a huge difference/benefit to go to rum instead

zackteo14:04:15

Am specifically building a frontend interface to input constraints (be it check-boxes or sliders) and based on that state, send it as a query to the clojure backend

thheller14:04:58

the setup videos are free, maybe those help

thheller14:04:16

or maybe use the re-frame template and compare what it generated vs. the raw setup you have now

zackteo14:04:21

Hmmm okay okay! I'll start from there šŸ™‚ Thanks!

Max15:04:03

As Iā€™ve worked on my small reagent/shadow-cljs side-project, Iā€™ve noticed the split between my repl and my actual app more and more, especially while debugging. The repl is fine for testing functions in isolation, but being able to inspect my appā€™s state (without resorting to prn debugging) would be really nice. Is there a (reasonable) way to connect a repl to an actual app? Or would that take me far off the beaten path?

djblue16:04:43

Also, you can (tap> value)https://clojuredocs.org/clojure.core/tap%3Eand view the data in the shadow-cljs inspector (http://localhost:9630/inspect) which really helps as your app state starts to grow.

Max16:04:33

the inspector is new to me, that looks really useful!

šŸ’Æ 3
thheller15:04:18

@max.r.rothman pretty much all targets support a REPL? how are you using the REPL now?

thheller15:04:21

shadow-cljs watch app and then separately shadow-cljs cljs-repl app would give you a REPL into the app build for example

Max16:04:45

Iā€™ve got this in my shadow-cljs.edn:

:dev-http {8080 "public"}

 :builds
 {:frontend {:target :browser
             :modules {:main {:init-fn myapp.main/init}}}}
I typically launch a repl using Calva, which appears to be running this command:
npx shadow-cljs -d cider/cider-nrepl:0.25.8 watch :frontend
After it completes the build, it asks me which repl to start, giving me an option between node, browser, and my build. Selecting ā€œbrowserā€ open a tab that says ā€œCode entered in a browser-repl prompt will be evaluated here.ā€œ. Iā€™m very much new to cljs, and definitely donā€™t understand how all the pieces fit together yet, so I really appreciate the help!

thheller16:04:55

select your build, not browser

thheller16:04:22

browser is just a plain standalone REPL, if you select frontend it'll be your build

Lari Saukkonen16:04:07

Lol I didnt realize this either. Ty vm!

Max16:04:11

I hadnā€™t been using that because when I try, my repl says ā€œNo available JS runtimeā€ and links to a troubleshooting doc. I read through the doc and didnā€™t see anything that seemed relevant (to my newbie eyes), figured I had done something wrong, and went back to the plain browser option

Max16:04:19

is there a way to get that to work?

thheller16:04:17

No available JS runtime means that you need to open in the browser first. it is your app you want to REPL into so you need to load your app in the browser

thheller16:04:22

pretty straightforward šŸ˜›

Max16:04:39

facepalm of course. That works perfectly, thanks for the help!