How to sequence dom-node insert effects? I'm having trouble with dom/select, in that dom/options need to be in place before I can effect dom/props for a selected value. I've tried:
(dom/select
(let [option-nodes
(e/as-vec
(e/for [i (e/diff-by identity (map str (range 10)))]
(dom/option (dom/props {:value i})
(dom/text i)
dom/node)))]
(case (prn option-nodes)
(dom/props {:value "5"}))))
This doesn't work. Looking at the source code (With-element), I assumed dom attach effects don't return anything, we cannot control them via given dom API, they run concurrently and just happen "eventually"?Not directly answering your question, but a workaround is to set selected on the option:
(dom/select
(dom/option (dom/props {:value "1"}) (dom/text "one"))
(dom/option (dom/props {:value "2", :selected true}) (dom/text "two"))
(dom/option (dom/props {:value "3"}) (dom/text "three")))OH! That's all I need. Thank you!
Is it possible to have an Electric function which runs a form and returns something else without unmounting the form?
(e/fn F []
;; How can I prevent this form from being unmounted when y is returned?
(e/client (reset! !x (e/server (slow-query))))
y)(do x y) will race x and y concurrently, but it won't unmount them, the caller of the lambda is responsible for that, is this electric v2 dom/on ?
regardless, (case x y) will sequence y after x through explicit causality, meaning y will not be returned until after x boots
Ohh, maybe I did something else wrong.
Iām on Electric v3.
(case (e/client (reset! !x (e/server (slow-query)))) y) is not what I want, as I want to return from F before (e/client (reset! !x (e/server (slow-query)))) finished.
https://xyproblem.info/ we need more context about what you are trying to do
has anyone had luck getting rcf working in babashka?
Don't know if RCF works but this one does work with bb: https://github.com/matthewdowney/rich-comment-tests
rcf seems to fail here fwiw https://github.com/hyperfiddle/rcf/blob/master/src/hyperfiddle/rcf/analyzer.clj#L91
but I'll try giving that a shot
@corasaurus-hex do you have a repro handy that I can locally run? Perhaps it's fixable in bb
let me see if I can isolate it
just a sec
https://gist.github.com/corasaurus-hex/5188cd5a15229612b00d511f753b4cb6
looks like vars don't have a .ns field?
this is correct, in SCI vars don't have ns field
if RCF can go through the var metadata instead of Java interop, it would work in SCI as well
RCF master has babashka support, based on the dates of the PR and the latest maven release i may never have published a new release for it
oh gosh I even provided a PR for that, I totally forgot
we recently (finally!) moved to a monorepo pattern that we're happy with (with the ability to push split subtrees to github), which should make it a LOT easier for us to test changes like this and cut releases easily, which has historically been the holdup
time to cut a release? I suppose I could run it from main, though
we have to test it first
Any chance you could share the code for dustingetz.trivial-datascript-form referred to in the form explainer https://electric.hyperfiddle.net/tutorial/form_explainer ? Thanks!