Fork me on GitHub
#hyperfiddle
<
2023-10-06
>
nivekuil18:10:18

can an electric app be split across modules?

Dustin Getz18:10:41

we have not thought about module splitting yet, but after the current incremental compiler workstream lands this will be closer at least

JAtkins21:10:36

https://github.com/JJ-Atkinson/electric-data-viewer I'm not entirely sure why this is borked. I'm inferring that e/hook is cooking up some failures, due to moving the dom/text nodes around. Not sure why they are being moved though. The goal with this code is to make a server-walked viewer for data, so java objects can be arbitrarily inspected.

JAtkins21:10:33

Should be a relatively small proj - it's based on electric starter app. LMK if I need to trim it down to an MVP or if this is close enough to minimal to be understood

Dustin Getz21:10:14

repo is private

😬 1
JAtkins21:10:50

public now

Dustin Getz21:10:36

ty, what is mount-watcher ?

JAtkins21:10:00

I needed something to wait for dom elements of an id to mount

Dustin Getz21:10:02

or rather what are you using mutationobserver for

JAtkins21:10:47

the viewers don't know anything about children, they just mount dom objects of ::view-options/id id and let children hang off that id by binding dom/with

JAtkins21:10:12

very mutate-y heavy UI

JAtkins21:10:23

if there's a better way for this I'm all ears though

JAtkins21:10:57

at t=0 the table is rendered, and the dom elements for rendering A and B are attached. t=1 those two elements are seen and children for viewers are mounted

Dustin Getz21:10:27

oh, without looking (on mobile) rebinding dom/node is undefined behavior in electric v2. this is supported in v3 which isn’t out. Because obviously it’s surprising for that to be UB and it’s a perfectly reasonable thing to want to do and quite powerful. In the meantime can this be expressed without rebinding dom/node?

JAtkins21:10:20

Maybe. I'll give it a try. Sorry didn't know dom/with isn't supported 😬 - guess it makes sense that that's borked behavior

JAtkins21:10:46

Might be able to get it into a tree of e/fn calls

Dustin Getz21:10:49

yeah i now see you’re calling dom/with not rebinding dom/node, i need to go oook at the src when back at my desk later

JAtkins22:10:01

got it to work basically in place with an atom of anonomized e/fn [] atoms. Pushed if you are interested.

👍 1
Dustin Getz22:10:38

i will try to look, good job figuring that out

nivekuil23:10:47

i've had that exact same error rebinding node to js/document.body. workaround was to change render order for some reason

nivekuil23:10:51

you shouldn't have multiple watches on the same atom I think? view-db/!id->view-fn

Vincent23:10:26

Who wants to build a music streaming service with electric and me 😄 I think Electric is a great fit for such a project It's such a huge undertaking; I was wondering: is there a clean way to stream audio via the websocket connection? That's my biggest/fuzziest/vaguest spot right now.

Dustin Getz23:10:15

i would use a raw websocket for something like that today, use electric for the UI parts (you can have N websockets)

👍 1
Vincent23:10:04

and not sure how i would do gapless playback, that would be a must

Vincent23:10:13

but maybe socket / channel logic is enough to do that in clj land

nivekuil23:10:41

look at webtransport if you want to do something novel

👁️ 1
Vincent02:10:57

does webtransport save me from having to make an iOS and android app? 😅 looks like HTTP3 supersocket basically main use case is mobile users so i ... wonder...

nivekuil03:10:20

maybe, though I think you'd have to build a clojure webtransport stack first

Vincent03:10:34

someone will