hyperfiddle 2025-03-12

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

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!

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

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

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

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

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

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

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

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

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