This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-14
Channels
- # announcements (10)
- # architecture (3)
- # atom-editor (1)
- # babashka (53)
- # babashka-sci-dev (118)
- # beginners (74)
- # biff (10)
- # calva (13)
- # clara (13)
- # clerk (20)
- # clj-commons (17)
- # clj-kondo (6)
- # cljdoc (19)
- # cljs-dev (3)
- # clojars (2)
- # clojure (63)
- # clojure-art (2)
- # clojure-europe (68)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-uk (3)
- # clojured (19)
- # clojurescript (34)
- # clr (1)
- # cursive (11)
- # emacs (12)
- # fulcro (3)
- # helix (2)
- # holy-lambda (2)
- # honeysql (27)
- # hyperfiddle (36)
- # malli (2)
- # off-topic (72)
- # polylith (4)
- # rdf (20)
- # re-frame (20)
- # reitit (4)
- # rewrite-clj (14)
- # shadow-cljs (17)
- # slack-help (2)
- # tools-deps (36)
- # xtdb (3)
hello, I just started learning Clojure and I really appreciate this Electric library. However, I don't know how to use it in an Expo + React Native project. I tried modifying the https://github.com/PEZ/rn-rf-shadow project, but I've been struggling for a day with configuring deps.edn and shadow-cljs.edn, and I can't seem to make it work. Could you give me some advice on this? Thank you.
We have not yet tried React Native, it will likely not work yet with Electric
I have no reason to believe it won't work, but we know nothing about React Native as a platform, so I'd assume some minor work is required
Thank you for your reply, I will keep trying and hopefully make some progress soon.
would like to set pending state on an atom for a loading state but strangely pending is caught twice
(defmacro set-pending [atm & body]
`(try (let [ret# (do [email protected])]
(and (do ret# true)
(do (println :done) true)
(reset! ~atm false)
ret#))
(catch Pending e#
(println :pending)
(reset! ~atm true)
(throw e#))))
I mean if the body goes e.g. Pending, v, Pending, v
then seeing 2 Pendings is fine, right?
I see. That's because in electric almost everything is running concurrently. (try a b c)
will run all of them at the same time. So (reset! !p false)
will finish before hitting the catch handler
to elaborate a bit, the electric code
(do (throw (ex-info "boom" {}))
(println "hi"))
will both throw and print, because all of do
s children are running concurrently(defmacro set-pending [atm & body]
`(try (do
(e/on-unmount #(reset! ~atm false))
[email protected])
(catch Pending e#
(reset! ~atm true)
(throw e#))))
I'd put the unmount call in the catch block. In your use case ( (dom/on "click" (e/fn [_] <here>))
) it makes no difference though
i think we are seeing it too
what commit are you on?
are you doing css work lately?
We're bisecting, the key piece of the repro is to touch a css file and ALSO load it like this: (dom/link (dom/props {:rel :stylesheet, :href "/todomvc.css"}))
Seems we can repro all the way back to last summer
Are you also loading css like that?
is there a different / better way to load a css file for electric? That form matches https://github.com/hyperfiddle/electric-starter-app/blob/main/src/app/todo_list.cljc#L57
Yeah you can probably work around this by loading css through index.html
Peter bisected this back to August 2022, this is the first time we noticed
@U050CJFRU this might be related to a fix we just landed, can you try updating to latest master and see if the problem still persists?
@U09FL65DK it seems to be gone! will report back should I see it again. thank you!
@U09FL65DK on master still seeing this occasionally