vecty icon indicating copy to clipboard operation
vecty copied to clipboard

Components cannot return List/KeyedList even though it is valid ComponentOrHTML

Open emidoots opened this issue 7 years ago • 4 comments

After merging https://github.com/gopherjs/vecty/pull/158 it came to our attention that a Component Render method cannot return List / KeyedList even though it is valid ComponentOrHTML.

See https://github.com/gopherjs/vecty/pull/158#issuecomment-341882684

emidoots avatar Nov 04 '17 19:11 emidoots

Error: vecty: internal error (unexpected ComponentOrHTML type vecty.List)

I'm hoping users will find this issue when searching for the above panic message now.

bzub avatar Mar 07 '18 19:03 bzub

Oh, so it's a bug actually. Damn :sweat_smile:. This is a must IMHO, otherwise we're forced to add an additional HTML tag as a workaround.

elboletaire avatar Aug 25 '20 11:08 elboletaire

It seems this has been a bug for five years, has a solution emerged in the meantime? Or is it just not possible to have multiple top-level elements in a component?

PotatoesFall avatar Jan 26 '22 08:01 PotatoesFall

@PotatoesFall you just have to have the children exist within an HTML element.

return vecty.Div(
    ...child components...
)

Yeah, this would be nice to fix (PRs welcome) but it's not the end of the world.

emidoots avatar Jan 28 '22 05:01 emidoots