Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow nesting functions for updating children #40

Open
alicesaidhi opened this issue Sep 25, 2024 · 0 comments
Open

Allow nesting functions for updating children #40

alicesaidhi opened this issue Sep 25, 2024 · 0 comments

Comments

@alicesaidhi
Copy link
Contributor

alicesaidhi commented Sep 25, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant