fix(runtime): Column node added a div with empty Repeater (#45)

When the Column node only had an empty Repeater child, there was an empty HTML element.
This commit is contained in:
Eric Tuvesson
2024-06-27 21:16:50 +02:00
committed by GitHub
parent c5754c9160
commit 8c7d4faeca

View File

@@ -117,7 +117,10 @@ export function Columns(props: ColumnsProps) {
// ForEachCompoent breaks the layout but is needed to send onMount/onUnmount
if (!Array.isArray(props.children)) {
children = [props.children];
// @ts-expect-error props.children.type is any
if (props.children.type !== ForEachComponent) {
children = [props.children]
}
} else {
children = props.children.filter((child) => child.type !== ForEachComponent);
forEachComponent = props.children.find((child) => child.type === ForEachComponent);