Get help from the marimo community

Updated 3 weeks ago

Why do mo.ui.batch & mo.ui.array clone their contained elements?

batch/array both clone their elements. Why is that needed? What would happen if an UIElement with children wouldn't do that?
y
1 comment
I'm asking as this obviously breaks code where the on_changed callback has a reference to the element it needs to change -> oops the element was cloned and the parameter that was used to create it, is actually meaning less.

I guess the whole notation is meant to have an on_change handler on the parent (batch/array) even if it makes more sense, design wise to do it at a row level (as the rows represent objects, so interacting with UIElements in one row will basically change the status of the object represented by the row)
Add a reply
Sign up and join the conversation on Discord