ranile / material-yew

Yew wrapper for Material Web Components
https://material-yew.rm.rs
Apache License 2.0
230 stars 35 forks source link

Enable stateful callbacks #45

Closed matt-duch closed 4 months ago

matt-duch commented 1 year ago

It's possible that a callback is rendered with captured information from the time of the render (so it changes over time). For example, if the menu list changes, and the callback needs to resolve an integer index into a value from the list.

In the current approach, after the callback is set the first time, it's never updated.

This is a proposal to update the listeners as the callbacks are changed. There are a number of different ways to handle this (for example, moving the action/attribute name to bind to into a new function, rather than specifying it in the render function), and I'm happy to talk more and iterate on this (names, structure, etc). Please let me know what you think of this approach!

If this (or a variation of this works), I could probably tackle updating a number of the elements to follow this approach.

ranile commented 4 months ago

closing this PR, all the library code has been rewritten