This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-05
Channels
- # adventofcode (50)
- # announcements (1)
- # asami (29)
- # babashka (56)
- # beginners (19)
- # calva (62)
- # cider (12)
- # cljs-dev (1)
- # clojure (42)
- # clojure-europe (214)
- # clojure-france (4)
- # clojure-italy (1)
- # clojurescript (58)
- # community-development (4)
- # cryogen (6)
- # cursive (7)
- # data-science (1)
- # events (3)
- # figwheel-main (1)
- # fulcro (21)
- # lambdaisland (3)
- # malli (17)
- # mid-cities-meetup (1)
- # off-topic (38)
- # pathom (3)
- # reagent (7)
- # reclojure (1)
- # reveal (15)
- # rewrite-clj (11)
- # shadow-cljs (30)
- # sql (21)
- # test-check (14)
- # tools-deps (1)
- # vim (21)
- # xtdb (5)
I have an embedded environment (arm v7l) and want to get a cljs repl using only node. Anyone an idea how to get there? using shadow-cljs I can compile cljs to js and run it on the target platform, but the target platform has no java
@b you can just run shadow-cljs on your machine. all you need is a websocket connection from node back to your machine
in my mind I would have to deploy a nrepl-server cljs bundle, which I can then invoke via "node nrepl.js" and that way I can connect to it from my dev environment
the output of the shadow-cljs build is designed to connect back to the running shadow-cljs watch
you just might need to tune a couple settings since the :node-script
output usually assumes that is running on the machine it was compiled on
sshfs to the target platform, so my "out"-dir is on the target platform and then I invoke shadow-cljs with watch and tune some parameters so my dev environment IP is used to connect back from node when I run node on the target platform
I had this problem before, if I don't use release then I get an error when trying to run the script.js on the target
Error: ENOENT: no such file or directory, open '/home/root/.shadow-cljs/builds/script/dev/out/cljs-runtime/goog.debug.error.js'
otherwise it defaults to using the .shadow-cljs
temp dir which you probably haven't mounted
now I get a new error when running "node script.js" on the target platform: Error: Cannot find module 'ws'
okay now there is no error, now we're at the part where it tries to connect to localhost
(I've set :devtools-url to http://my-internal/ip
okay I manually edited the global.CLOSURE_DEFINES property of shadow.cljs.devtools.client.env.server_host and it connects! Very cool
don't forget the port too so :devtools {:devtools-url "
in your build config of course
noob question: this resets my-atom
:
(reset! my-atom 300)
but this doesn't:
(#(reset! my-atom %) 2)
do you know why?ok it seems it was something in my keybindings that was evaluating the wrong thing. Never mind 😄
Hello! Two questions: 1 - Can I use cljsjs packages along with npm packages in the same project? 2 - If I use npm packages do I have to import react if I'm using reagent?
1 - yes, https://clojurescript.org/news/2017-07-12-clojurescript-is-not-an-island-integrating-node-modules
2 - no, react comes bundled with reagent - but you can exclude it and add your own, see :exclusions here https://github.com/reagent-project/reagent
The answer to 2 depends on the build tool. With shadow-cljs, you don't have to exclude anything - you just need to install React via NPM.
it is a bad idea to use cljsjs AND npm at the same time. you'll very likely have things duplicated and possibly conflicting with each other.
Interesting reagent atom behavior that I am stuck on. I'm a few callbacks deep in a callback stack, and am trying to reset an atom to the argument passed into the callback. A call to reset!
does nothing, while I am still unable to print the value. I wrote a little test function
(defn reset-and-print [atom val]
(print val)
(reset! atom val))
My value gets printed, but the atom does not get reset, and there are no errors.probably the atom is being reset but you didn't close over it and so its recreating the component with a fresh atom each time and so it appears like nothing is changing.
(defn my-component-with-state []
(let [showing (r/atom false)]
(fn []
(if @showing
[:div "Showing"]
[:button {:on-click #(reset! showing true)} "Not showing"]))))
My atom is top level though
I added a watch to it, and it is not getting updated
I'm trying to make a MWE
what is MWE ?
minimal working example
:thumbsup:
Apparently my repl wasn't connected to the right browser session.
All good! Thank you for your help @U5RCSJ6BB
np. glad it was something silly
I tried with a normal atom, not an r/atom and I see the same behavior