hyperfiddle

braai engineer 2025-10-06T11:28:12.973039Z

Electric v3 bubbling tree value challenge: • given a nested tree component with nodes • each node has entries & child nodes which can be expanded • how to search for entries at each node level, return a count to parent so that the parent can selectively expand tree branches where leaf nodes have matching entries? Essentially a feedback loop from leaf to root, so that root can decide which nodes to expand to reveal matching nodes.

Dustin Getz (Hyperfiddle) 2025-10-06T12:38:06.131569Z

your goal is a folding treeview UX, like macos finder?

braai engineer 2025-10-06T12:41:20.922829Z

essentially, yes - to expand all subtrees that have matching child "files" when searching for a needle I could do a global search from the caller and pass down a list of all folder IDs that contain matching files, but then I'm repeating the search query. would be nice if the leaf nodes could pass up this information to the caller and it decides how to expand the tree I could probably use a set atom for this so each child conducting a search with results adds its ID (& parent IDs?) to the set, so the root can expand those if those IDs are present in the set during sarching.

braai engineer 2025-10-06T12:47:48.840829Z

maybe I could use the DOM's bubbling events to trigger a sort of 'click' event from a child when it has matches and the parent has an event listener for that?

braai engineer 2025-10-06T12:49:25.980399Z

e.g. in parent:

(dom/On "expand" (fn [_e] (reset! !expand-children? true)) nil)
and in child,
(.dispatchEvent dom/node (js/Event. "expand"))
?

braai engineer 2025-10-06T12:53:56.448519Z

Hey, it works!

🙌 1
braai engineer 2025-10-06T12:53:59.087039Z

awesome

braai engineer 2025-10-06T16:43:41.249329Z

Checkbox: why does the dom/text label render before the input instead of after?

braai engineer 2025-10-06T16:46:23.728429Z

...even though dom/text point effect is after the dom/input

braai engineer 2025-10-06T16:47:06.946569Z

ahhh, it must be because checked?' is only referenced after the dom/text, i.e. lazy let. let me see what happens if I put checked?' before the dom/text.

braai engineer 2025-10-06T16:48:08.396999Z

fixed with this. quite unintuitive that you can bind a dom element to let-symbol, but it does not render twice if you render it.

Dustin Getz (Hyperfiddle) 2025-10-06T17:13:41.158939Z

i think its a bug

Dustin Getz (Hyperfiddle) 2025-10-06T17:14:18.568159Z

i expect your original program to put the dom/input inside the dom/label, above the dom/text

braai engineer 2025-10-07T07:06:22.189909Z

is it not expected because the let-binding to dom/input was first used after the dom/text, so it races?

braai engineer 2025-10-07T14:31:18.486919Z

I moved the virtual scroll fetch query out of e/Offload, and now I see this error in browser controle after some activity and lots of elements on screen. No logs on server.

braai engineer 2025-10-07T14:31:44.686219Z

before that, it shows this:

[Violation] 'setTimeout' handler took <N>ms
electric_dom3_events.cljc:18 [Violation] 'click' handler took 2199ms
electric_dom3_events.cljc:18 [Violation] 'click' handler took 1601ms
electric_scroll0.cljc:14 [Violation] 'scroll' handler took 610ms
electric_scroll0.cljc:14 [Violation] 'scroll' handler took 201ms

braai engineer 2025-10-07T14:32:13.471549Z

However, this does not seem to deadlock reactor for everyone else – just that one client. So not the same symptom.