This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-30
Channels
- # announcements (2)
- # babashka (3)
- # beginners (31)
- # biff (3)
- # calva (40)
- # chlorine-clover (2)
- # clerk (5)
- # clj-kondo (10)
- # clojure (13)
- # clojure-art (1)
- # clojure-denver (16)
- # clojure-europe (44)
- # clojure-nl (1)
- # clojure-norway (27)
- # clojure-sweden (3)
- # clojure-uk (1)
- # clojurescript (49)
- # clr (6)
- # community-development (2)
- # datalevin (10)
- # datomic (63)
- # events (2)
- # fulcro (9)
- # holy-lambda (15)
- # honeysql (8)
- # hoplon (6)
- # hyperfiddle (9)
- # introduce-yourself (1)
- # kaocha (1)
- # london-clojurians (2)
- # matrix (1)
- # nbb (7)
- # off-topic (38)
- # polylith (6)
- # re-frame (4)
- # reagent (2)
- # releases (3)
- # sci (13)
- # scittle (5)
- # shadow-cljs (6)
- # sql (5)
- # tools-deps (4)
- # vim (33)
- # web-security (8)
- # xtdb (2)
Hi, I’m looking into the electric starter app. I wonder when exactly the shadow load the app.todo-list. Thanks in advance.
Hi, do you mean https://github.com/hyperfiddle/electric-starter-app/blob/cd8e92b8aa0de51f02d59036cfc02fc6dc9df650/src/user.cljs#L10?
No, I mean about how to call https://github.com/hyperfiddle/electric-starter-app/blob/cd8e92b8aa0de51f02d59036cfc02fc6dc9df650/src/user.cljs#LL14C1-L14C42 when execute the code.
shadow-cljs https://shadow-cljs.github.io/docs/UsersGuide.html#_lifecycle_hooks for hot code reloading. The app entrypoint is set in https://github.com/hyperfiddle/electric-starter-app/blob/cd8e92b8aa0de51f02d59036cfc02fc6dc9df650/shadow-cljs.edn#L11-L12
Hello! I am seeing behavior that I don't understand and I am wondering if it could be a bug in electric and/or e/for
. In this snippet, my expectation is that no code inside a when block would ever execute when the value of the condition is false, but I see that happen with the code below. I'd appreciate any insight into what is happening here. I am using electric v2-alpha-284-g0bc5f4bc and missionary b.30
(e/defn ComponentWithFor [items]
(dom/ul
(e/for [item items]
(dom/li (dom/text item)))))
(e/defn StrangeBugRepro []
(let [!x (atom 0)
x (e/watch !x)]
;; When this button is clicked, "x: nil" prints to the console
(ui4/button (e/fn []
(reset! !x nil))
(dom/text "Reset x to nil"))
(when x
;; This should never print if x is nil... right? It does if...
(println "x:" x)
;; ...there is another electric function call in the
;; when that uses e/for and the e/for depends on x. Does not
;; occur if e/for is inlined.
(ComponentWithFor. (range x))
)))
Hey, thanks for the report and the repro! We're aware of a similar issue but it includes a server transfer, while your case involves only involves an e/for
. I logged a ticket for this. The internals are going through a major rewrite that might solve this issue, otherwise we'll look into it after the internal rewrite lands.
Do you need help finding a workaround for your project?
Including a minimal RCF for reference.
@U052PH695 does the same thing happens when not using the ui4/button
helper? E.g. (dom/a (dom/on "click" (e/fn [e] (reset! !x nil) …))
I’ve had similar issues with ui4/button, but may be a different edge case.
