centau / vide

A reactive Luau library for creating UI.
https://centau.github.io/vide/
MIT License
95 stars 16 forks source link

Nested `show()` calls throw an error #31

Closed littensy closed 3 months ago

littensy commented 3 months ago

Nested show() calls (or any component that returns a function in show) throw the following error:

bind:55: attempt to index function with 'Parent'

Repro

Vide.mount(function()
    local truthy = Vide.source(true)

    return Vide.show(truthy, function()
        return Vide.show(truthy, function()
            return Vide.create("Frame")({ Size = UDim2.new(1, 0, 1, 0) })
        end)
    end)
end, target)
centau commented 3 months ago

This is effectively setting, as a child, a source returning another source - this doesn't have a defined behavior. Vide will assume the value of the outer source is an instance to be parented.

Rather than allowing this I think it would be clearer to have an intermediate GUI object that can be set as a parent.

littensy commented 3 months ago

This is effectively setting, as a child, a source returning another source - this doesn't have a defined behavior.

That's a good way to put it. I'll close this issue.