This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-19
Channels
- # announcements (1)
- # babashka (40)
- # beginners (84)
- # biff (46)
- # calva (37)
- # cherry (2)
- # cider (18)
- # clj-otel (5)
- # clojure (53)
- # clojure-europe (39)
- # clojure-hungary (12)
- # clojure-norway (40)
- # clojure-sweden (2)
- # clojure-uk (2)
- # clojurescript (6)
- # community-development (21)
- # cursive (28)
- # data-science (12)
- # datomic (3)
- # figwheel-main (2)
- # fulcro (12)
- # graalvm (7)
- # gratitude (1)
- # hyperfiddle (23)
- # integrant (9)
- # jobs (2)
- # leiningen (4)
- # lsp (8)
- # malli (3)
- # missionary (1)
- # off-topic (39)
- # polylith (3)
- # portal (33)
- # practicalli (4)
- # re-frame (3)
- # releases (1)
- # sci (53)
- # solo-full-stack (8)
- # sql (5)
- # timbre (9)
In what situation does a body expression in e/fn won’t be executed and is skipped? I have a function where I do datalog query. This function is triggered when an event happens and the corresponding atom changes. The issue is that any expression that depends on the query won’t be executed.
(e/defn create-data! [data]
(let [a (e/server (d/q '[A-DataLog-Query] db))
]
(e/client
(println "First") ;Executed regularly
(println "Second" a)) ;It is skipped
)
)
can you show the callsite? Most likely the callsite is mounting and immediately unmounting the e/fn, so anything synchronous gets through and anything that requires a roundtrip is lost
the -switch
in the name means if a new event arrives the previous one's execution is cancelled. My guess is a new event arrives in before the previous finished executing. You can check by printing out the events.
If you need all events processed, even if they overlap (overlap = event E1 is still running while E2 comes in), use e/for-event-pending
Is it possible that only the expressions that depends is lost, and others return properly?
these helpers don't rethrow exceptions, you can wrap it like https://github.com/hyperfiddle/electric/blob/5a3799bdca4f70aed0dc51ac98ff9728dbffacae/src/hyperfiddle/electric_dom2.cljc#L229
(let [[state v] (e/for-event-pending-switch ...)]
(case state (::e/init ::e/ok) v (::e/pending ::e/failed) (throw v)))
the for-event apis are not meant for userland use due to how complicated they are currently, how did we end up calling them? have i missed something?
oh ok thanks
e/on-unmount
still exists: https://github.com/hyperfiddle/electric/blob/5a3799bdca4f70aed0dc51ac98ff9728dbffacae/src/hyperfiddle/electric.cljc#L426
Yes thanks Tommy - this API has not been deprecated