Fork me on GitHub
#humbleui
<
2022-10-31
>
lilactown16:10:11

is there an explainer on what ui/dynamic does?

lilactown16:10:43

real question: what does ui/dynamic do? also wondering if there's an explainer I'm missing

lilactown16:10:17

ah ok, it seems to automatically listen to any atoms that are derefed in the bindings list

lilactown16:10:20

I wonder how it works...

lilactown16:10:36

ah it only seems to work when changing the atom in an event, like an on-click

lilactown16:10:05

so it's not watching the atoms

lilactown16:10:13

oh nm, it just wasn't re-rendering because it wasn't focused

Niki16:10:33

Thing is it doesn’t actively listening

Niki16:10:08

Buf if re-render happens it compares declared dependencies and if they changed rebuilds component tree inside

Niki16:10:39

It’s actually a temporary solution until we get some sort of state management

lilactown16:10:43

ahhh it reruns the inputs-fn on each event 👍:skin-tone-2:

lilactown16:10:19

do you have a design in mind for state management?

lilactown17:10:12

how does re-rendering components work?

zeitstein17:10:17

Hope you don't mind me chiming in. I think it's worthwhile looking at https://github.com/thheller/shadow-grove as inspiration for state management.

lilactown19:10:39

i would not do that tbf for a generalized UI library. the whole "single atom with a normalized app db" state management doesn't make sense if you're trying to create reusable components that maintain their own state

👍 1
lilactown19:10:19

things like shadow-grove's approach, re-frame, fulcro etc. make sense as higher level application frameworks

Niki21:10:14

I hope for Humble UI to have universal layer that can be bridged with any state management

👍 2
Niki21:10:41

> how does re-rendering components work? When you call -draw. It’s scheduled when -event returns non-nil, or you can schedule it manually by calling window/request-frame. The problem with dynamic as it is right now is that it will update when rendered but won’t schedule re-render itself

Niki21:10:01

This is very ad-hoc right now, so don’t give it much thought

lilactown22:10:07

I see, so -draw will locally redraw the component instance when called. it looks like most components also call -draw on their children when it's called, too. does window/request-frame call -draw on the root component instance, which is what you mean by scheduling it manually? can I get a reference to a specific component and call -draw on it myself, to localize the re-render?

Niki23:10:11

right now only from top level

1
lilactown23:10:44

it seems hard to render individual component instances because i need to call the -draw method not only with the component and context, but also a rect and canvas, which i'm not sure how to get a reference to

lilactown23:10:12

i know this isn't baked, i'm just poking around 🙂 curious if i can try some experiments