clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
thheller 2021-06-24T06:21:51.006700Z

there are a couple other regressions caused by that commit already reported.

thheller 2021-06-24T06:22:14.006900Z

https://clojure.atlassian.net/browse/CLJS-3311

thheller 2021-06-24T06:22:38.007100Z

https://clojure.atlassian.net/browse/CLJS-3312

Péter Szalai 2021-06-24T08:06:10.011600Z

hey, beginner here would like to use [hiccup "1.0.5"] in my project. added to :dependencies in shadow-cljs.edn when I try to use html on dynamic arrays, I get this Unable to resolve var: render-html in this context. I know hiccup.core/html is a macro and it uses render-html to render it elements run time, but why is it not able to resolve it.

(defn render-bgrd [elm]
      (let [id (. elm data "id")]
        (str "data:image/svg+xml;base64,"
           (js/btoa (hiccup.core/html [:svg {} [:text {} id ] ])))))

thheller 2021-06-24T08:35:44.012200Z

@szalaipeti.vagyok hiccup is a clojure only library. you cannot use it with clojurescript.

👍 1
simongray 2021-06-25T13:45:34.017600Z

Usually, people using Hiccup directly in CLJS will be using it through reagent.

🙌 2
Péter Szalai 2021-06-24T10:57:01.012400Z

thanks, how do people render html/svg runtime in cljs?

p-himik 2021-06-24T11:33:40.012600Z

If you need to just render and forget, then looking up "clojurescript hiccup" gives https://github.com/teropa/hiccups

🙌 1
Daniel Flores Garcia 2021-06-24T18:35:44.013500Z

Hello! I’m trying to run a computationally intensive Clojure system in Clojurescript and I’m getting the error “The previously used runtime disappeared. Will attempt to pick a new one when available but your state might be gone.” Does that mean I’m hitting a Javascript limit of some kind? I don’t get the error, or it comes later, if I run with less demanding parameters. I’m totally new to the JS ecosystem so would appreciate any pointers!

p-himik 2021-06-24T18:47:19.013600Z

It's an error from your REPL. "Runtime" is a correctly set up process that executes your CLJS code. REPL has lost its connection to that runtime. One reason it might happen is that you're trying to send something rather big over the REPL's WebSocket connection (e.g. during hot code reload or just a form evaluation). I don't know the exact details but I remember hitting similar issues with a WebSocket (albeit, with a completely different stack) when I tried sending around 10MB of data in one message.

dnolen 2021-06-24T18:54:18.014200Z

@dfloresgarcia24 OOM is possible - you haven't clarified what enviornment you are trying this in

Daniel Flores Garcia 2021-06-24T19:25:14.014400Z

Thank you! If that is the reason, do you know if there’s anything I could to work around this?

p-himik 2021-06-24T19:26:45.014600Z

If the problem is indeed with sending large messages over a WebSocket, then there are two obvious solutions: • Reduce the amount of data you send • Don't use WebSockets There's a third possibility - research if it's possible to configure a WebSocket connection to increase that data size limit. I have no clue if that's feasible.

👍 1
phronmophobic 2021-06-24T19:45:22.015Z

I've used https://github.com/exupero/vdom successfully in the past for a similar use case.

🙌 1
thheller 2021-06-24T20:29:02.015300Z

IIRC I did some tests with 100mb websocket messages without issue?

thheller 2021-06-24T20:29:34.015500Z

the runtime may just crash? is this node, browser or something else?

thheller 2021-06-24T20:33:51.015700Z

or how does your computation take? shadow-cljs kicks runtimes that don't respond after 30sec?

Daniel Flores Garcia 2021-06-24T20:53:15.015900Z

I’m running this in chrome, but it takes less than 30sec for shadow-cljs to kick the runtime

thheller 2021-06-24T20:59:38.016100Z

does it reconnect automatically? I really need more information to comment properly.