Allow providing arrays of subcomponents when crafting a component.

Review Request #13646 — Created March 18, 2024 and submitted — Latest diff uploaded

Information

Ink
master

Reviewers

When crafting a component, subcomponents are expected to be provided
one-by-one. This is fine in typical usage, but if a component needs to
pre-build subcomponent state and pass it in as an array of
subcomponents, then this will fail.

What happens is that the array of subcomponents ends up being provided
as a single child to a component. This doesn't get seen as subcomponent
information, since it's an array and not a subcomponent object.

Since the grammar doesn't provide something like ...${subcomponents}
outside of a <tag>, we instead need to handle this in the crafting
implementation.

We now handle any children that are arrays as possible lists of
subcomponents. We'll never have an array as a valid child outside of
this, so this should be safe and shouldn't impact any other usage.

This problem was first encountered in MenuButton.

All unit tests pass.

Hit this with MenuButton and verified I could capture and pass along
arrays of subcomponents.

Commits

Files

    Loading...