hyperfiddle

Absolute Negativity 2025-03-12T10:39:37.551029Z

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"?

Geoffrey Gaillard 2025-03-12T10:47:08.478509Z

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")))

šŸ™ 1
Absolute Negativity 2025-03-12T10:49:16.389989Z

OH! That's all I need. Thank you!

oλv 2025-03-12T13:06:54.505489Z

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)

Dustin Getz (Hyperfiddle) 2025-03-12T13:22:15.943979Z

(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 ?

Dustin Getz (Hyperfiddle) 2025-03-12T13:23:12.075579Z

regardless, (case x y) will sequence y after x through explicit causality, meaning y will not be returned until after x boots

oλv 2025-03-12T13:36:49.455069Z

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.

Dustin Getz (Hyperfiddle) 2025-03-12T14:04:20.879439Z

https://xyproblem.info/ we need more context about what you are trying to do

šŸ‘ 1
Cora (she/her) 2025-03-12T20:18:25.614779Z

has anyone had luck getting rcf working in babashka?

borkdude 2025-03-12T20:22:07.559179Z

Don't know if RCF works but this one does work with bb: https://github.com/matthewdowney/rich-comment-tests

Cora (she/her) 2025-03-12T20:24:13.187539Z

rcf seems to fail here fwiw https://github.com/hyperfiddle/rcf/blob/master/src/hyperfiddle/rcf/analyzer.clj#L91

Cora (she/her) 2025-03-12T20:24:17.407499Z

but I'll try giving that a shot

borkdude 2025-03-12T20:24:54.817739Z

@corasaurus-hex do you have a repro handy that I can locally run? Perhaps it's fixable in bb

Cora (she/her) 2025-03-12T20:25:38.436319Z

let me see if I can isolate it

Cora (she/her) 2025-03-12T20:25:40.272719Z

just a sec

Cora (she/her) 2025-03-12T20:30:17.436389Z

looks like vars don't have a .ns field?

borkdude 2025-03-12T20:30:40.349679Z

this is correct, in SCI vars don't have ns field

borkdude 2025-03-12T20:30:58.609559Z

if RCF can go through the var metadata instead of Java interop, it would work in SCI as well

Dustin Getz (Hyperfiddle) 2025-03-12T21:58:04.824379Z

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

šŸŽ‰ 1
borkdude 2025-03-12T21:59:14.820209Z

oh gosh I even provided a PR for that, I totally forgot

šŸ˜† 1
Dustin Getz (Hyperfiddle) 2025-03-12T21:59:53.089909Z

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

Cora (she/her) 2025-03-12T22:25:40.066669Z

time to cut a release? I suppose I could run it from main, though

Dustin Getz (Hyperfiddle) 2025-03-13T11:27:09.954369Z

we have to test it first

šŸ‘šŸ» 1
tobias 2025-03-12T01:52:20.636189Z

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!

Dustin Getz (Hyperfiddle) 2025-03-12T10:37:29.368349Z

šŸ™ 1