vide icon indicating copy to clipboard operation
vide copied to clipboard

Allow nesting functions for updating children

Open alicesaidhi opened this issue 1 year ago • 0 comments

Currently, it's not allowed to nest functions when updating children. Following code would error:

create "Frame" {
    indexes(t, function(name)
        return show(s, function()
            return create "Frame" {
                Name = name
            }
        end)
    end)
}

We can allow this behavior though through adding a single case to the update_children_effect function

elseif type(child) == "function" then
            process_child(child())

which would make the first example valid.

There is some value in allowing this behavior, as we would now be able to infinitely nest indexes, show, etc which may be more intuitive in roblox-ts. I believe @littensy also wanted this, considering that many of the control flow functions in vide are tsx elements there. Being able to treat them as regular components would be really nice for UX.

alicesaidhi avatar Sep 25 '24 09:09 alicesaidhi