humbleui

lilactown 2022-10-31T16:16:11.853189Z

is there an explainer on what ui/dynamic does?

lilactown 2022-10-31T16:16:43.383719Z

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

lilactown 2022-10-31T16:33:17.816559Z

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

lilactown 2022-10-31T16:33:20.754919Z

I wonder how it works...

lilactown 2022-10-31T16:34:36.242479Z

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

lilactown 2022-10-31T16:35:05.448089Z

so it's not watching the atoms

lilactown 2022-10-31T16:36:13.736979Z

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

Niki 2022-10-31T16:36:33.691259Z

Thing is it doesnโ€™t actively listening

Niki 2022-10-31T16:37:08.649139Z

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

Niki 2022-10-31T16:37:39.190619Z

Itโ€™s actually a temporary solution until we get some sort of state management

lilactown 2022-10-31T16:37:43.267049Z

ahhh it reruns the inputs-fn on each event ๐Ÿ‘๐Ÿป

lilactown 2022-10-31T16:38:19.238949Z

do you have a design in mind for state management?

Niki 2022-10-31T16:38:29.723319Z

Not yet

lilactown 2022-10-31T17:09:12.115969Z

how does re-rendering components work?

zeitstein 2022-10-31T17:42:17.198139Z

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.

lilactown 2022-10-31T19:08:39.843169Z

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
lilactown 2022-10-31T19:09:19.890989Z

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

Niki 2022-10-31T21:42:47.964689Z

I agree with @lilactown

Niki 2022-10-31T21:43:14.414709Z

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

๐Ÿ‘ 2
Niki 2022-10-31T21:44:41.737739Z

> 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

Niki 2022-10-31T21:45:01.741169Z

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

lilactown 2022-10-31T22:15:07.298919Z

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?

Niki 2022-10-31T23:28:11.769039Z

right now only from top level

๐Ÿ‘๐Ÿป 1
lilactown 2022-10-31T23:28:44.201229Z

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

lilactown 2022-10-31T23:29:12.089729Z

i know this isn't baked, i'm just poking around ๐Ÿ™‚ curious if i can try some experiments