This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-06-22
Channels
- # ai (1)
- # announcements (4)
- # babashka (23)
- # beginners (27)
- # biff (17)
- # calva (5)
- # clerk (6)
- # clj-commons (27)
- # clj-kondo (35)
- # clojars (12)
- # clojure (27)
- # clojure-denver (3)
- # clojure-europe (71)
- # clojure-norway (7)
- # clojure-spec (5)
- # clojure-uk (2)
- # clojurescript (45)
- # data-science (9)
- # datomic (4)
- # dev-tooling (2)
- # devcards (1)
- # hoplon (2)
- # hyperfiddle (36)
- # introduce-yourself (3)
- # malli (11)
- # missionary (2)
- # off-topic (63)
- # polylith (5)
- # rdf (2)
- # reagent (12)
- # schema (1)
- # shadow-cljs (11)
- # sql (6)
- # tools-deps (23)
- # xtdb (6)
I've noticed that when I change my reactive database from within a (ui/button (e/fn [] ...))
in some cases that e/fn updates twice or even causes an infinite update loop. How can I prevent that and "freeze" reactive vars on mount in the e/fn?
I can share the repo, but you probably won't be able to get it to repro easily because I don't have code to seed the database
@U09FL65DK sent a DM
I'm trying to demo electric-starter-app
on a fresh Mac that has Clojure installed via brew install clojure/tools/clojure
but am hitting a Cursive exception when opening the project or attempting to start a REPL in IntelliJ:
java.util.concurrent.ExecutionException: com.intellij.execution.ExecutionException: Cannot execute: /usr/local/bin/clojure does not exist
at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
at org.jetbrains.concurrency.AsyncPromise.get(AsyncPromise.kt:49)
I can run clj -A:dev -X user/main
in terminal just fine, but then I can't do REPLy things.
Hopefully this is a simple linking issue? I also tried brew install clojure
.leave off the -X user/main
and it drops you in a repl, then run (main)
to start the compiler
@U05AL1ZH8TW clj -A:dev
does not seem to start an nREPL, at least not one that I know how to connect to: there is no .nrepl-port
file.
I realize I can add an nREPL dependency etc., but would really like to be able to use the Local REPL feature in Cursive.
yeah, it's a plain clojure repl. I just did a quick search and it seems that you can configure Cursive to use a 'clojure.main REPL' which is what you want, I think: https://cursive-ide.com/userguide/repl.html#local-repls
FIXED: add a symlink like so:
sudo ln -s /opt/homebrew/bin/clj /usr/local/bin/clojure
yes because I installed Clojure via Homebrew, e.g.
➜ ~ which clj
/opt/homebrew/bin/clj
yes,
➜ ~ which clojure
/opt/homebrew/bin/clojure
no, it was looking for /usr/local/bin/clojure
which did not exist (and was not symlinked).
Both /opt/homebrew/bin/clj
and
/opt/homebrew/bin/clojure` are symlinks to files in Cellar paths.
I see that hyperfiddle.electric-svg/svg-element
, uses dom/with
and e/on-unmount
to inject SVG nodes. Would this be considered a good reference for dealing with imperative libraries that need access to underlying DOM nodes, e.g. Mapbox GL? For various reasons I don't want to use React go-betweens because it adds a lot Reagent/React complexity and would rather just add map events myself and deal with component lifecycle.
you don't need dom/with
, you just need dom/node
Thanks, Dustin. How do I do cleanup on unmount?
I see this: https://github.com/hyperfiddle/electric-examples-app/blob/1275f316e68520765446d2c294d4b5ea14cfc4e1/src/wip/js_interop.cljc#L19 Not obvious what the API is.
e/on-unmount?
Clean up what exactly?
on-unmount means what it means in reactjs
Your Mapbox integration is likely not going to be coded in electric, it will manage all the callbacks and events with a missionary adapter
so your callback allocation/disposal will be managed by m/observe
thx, any examples around? BlinkerComponent example is simple
search m/observe
Where should I search? In electric-examples-app
I find only this: https://github.com/hyperfiddle/electric-examples-app/blob/1275f316e68520765446d2c294d4b5ea14cfc4e1/src/user/demo_10k_dom.cljc#L14
I'm a little confused on how to achieve POST
via cljs-ajax from Client to Server.
(ui/button
(e/fn []
(do (.log js/console !w)
(POST "/create-account"
{:params {:w !w}
:format :text})))
(dom/text "Hit me"))
using cljs-ajax
to accomplish the POST
but on the server I see
:body #object[org.eclipse.jetty.server.HttpInputOverHTTP 0x21eee3a5 HttpInputOverHTTP@21eee3a5[c=0,q=0,[0]=null,s=STREAM]],
when reading ring-req
i’d guess you’re missing a middleware