hyperfiddle

braai engineer 2025-06-22T11:30:55.624309Z

Is there an Electric source code example using virtual scroll? I want to try it for https://github.com/theronic/eacl's lookup-resources which needs to paginate ~1M entities via cursor-based pagination.

Dustin Getz (Hyperfiddle) 2025-06-22T12:29:02.954559Z

search channel for virtual scroll patterns

Dustin Getz (Hyperfiddle) 2025-06-22T12:29:34.482999Z

we have not provided example cursor integrations though, this will be missionary layer integration, you may need to wait for us to provide it

2025-06-22T14:44:22.212809Z

I may be hopelessly confused, but I think I have an example where successive values of a signal are the same, which, IIUC, shouldn’t happen. See in thread for details.

2025-06-22T14:45:20.323499Z

My application has the following notions: • a selection • a hovered item • a focus item, which is the hovered item if there is one, otherwise the selection.

2025-06-22T14:45:37.232729Z

In the code below, when hover-id switches back and forth between nil and :the-selected-id, the code prints focus-id = :the-selected-id each time.

2025-06-22T14:45:44.011979Z

I would expect the printing to happen only once.

2025-06-22T14:45:50.271269Z

Am I confused or have I perhaps found a bug?

2025-06-22T14:46:36.698119Z

Dustin Getz (Hyperfiddle) 2025-06-22T15:41:11.653859Z

it can happen, once the clock signal is dirty, despite truncating it to a boolean, a value must be produced and pulled through the dag because the entrypoint has sampled the root signal due to being dirty. We think we can optimize this out but it is not optimized today. Basically, once an upstream signal changes and is not the same value as before, there is going to be a propagation from that point to the entrypoint.

❌ 1
2025-06-22T16:06:54.518339Z

Ah, OK. Good to know.

Dustin Getz (Hyperfiddle) 2025-06-22T16:13:39.937039Z

this is one of the things i wanted to look at in your app, can you remove any clocks, also you can try to minimize computation downstream of mousemove (can some of that be done in css?)

2025-06-22T16:40:26.612279Z

Yeah, I’ll take a look at both of those at some point. FWIW, I think there’s a lot in my app that can be improved, and stuff that wouldn’t be there if I were to start from scratch. Several reasons: • My focus up to now has been to get something that works. • I’ve been learning. • My porting from v2 to v3 introduced some weird hacks that I probably didn’t think about hard enough.

2025-06-22T22:25:09.610089Z

2025-06-22T22:27:33.218339Z

@dustingetz (not sure what you meant by “clocks”…) I don’t have any e/System-time-secs or e/System-time-ms in my app, but in my nomis-timelines.event-handlers.postponed-events namespace I do have some stuff driven from the clock` function in the above snippet. Do you want me to get rid of that? (It’s postponing handling of mouse events and seems to make things faster. There’s almost certainly a better way of doing what I’m doing.)

2025-06-24T08:55:50.561689Z

@dustingetz Thanks for the detailed explanation. e/Tap-diffs shows what you said, and I confirm that using e/Reconcile makes things behave as I want — no more duplicate side effects. (And I’ve been able to remove a nasty hack from my code.)

Dustin Getz (Hyperfiddle) 2025-06-24T09:51:29.865499Z

thanks

2025-06-24T12:30:49.588959Z

@dustingetz In case you’re still planning on looking at my code… I’ve created a new branch no-clocks-and-minimize-mousemove-computation-v2 based off the changes I’ve made this morning. FWIW, I may try improving performance myself in the next few days, but I’m not sure what time I will have or, if I do, what I will actually work on.

Dustin Getz (Hyperfiddle) 2025-06-24T12:47:32.823429Z

it's on our backlog, don't wait for us

👍 1
2025-06-23T14:29:35.763249Z

@dustingetz I’ve created a branch named no-clocks-and-minimize-mousemove-computation. There I’ve removed all “mousemove” event handlers and also the code for postponing events that I mentioned above (which is less relevant without the “mousemove” events). Let me know if there’s anything else / different you’d like me to do.

Dustin Getz (Hyperfiddle) 2025-06-23T16:33:48.954459Z

@nomiskatz I have misdiagnosed your problem. You are 100% correct that the println is expected to workskip. There will be a propagation but the propagation will be invisible because the jvm interop effects will be workskipped. What is happening here appears to be that the conditional when is rebooting its body each time the predicate is recomputed. So in diff terms you're getting shrink/grow (unmount/mount) instead of change. which is why you see the println each time. We agree that nobody wants the current observed behavior, we plan to fix this eventually. You can probably confirm this using e/Tap-diffs to see the lifecycle.

Dustin Getz (Hyperfiddle) 2025-06-23T16:34:28.498349Z

due to there still being a propagation it can still be a source of performance problems

Dustin Getz (Hyperfiddle) 2025-06-23T16:37:32.825739Z

workaround: wrap the when in e/Reconcile , let me know if that makes the println behave as expected

2025-06-23T16:40:02.625359Z

Thanks. I’m busy this evening. I’ll take a look tomorrow.