diff --git a/.changeset/spicy-pens-tease.md b/.changeset/spicy-pens-tease.md new file mode 100644 index 0000000000..89c226807c --- /dev/null +++ b/.changeset/spicy-pens-tease.md @@ -0,0 +1,5 @@ +--- +'@builder.io/mitosis': patch +--- + +Fix: Solid fragments rendering by removing all props diff --git a/packages/core/src/__tests__/__snapshots__/solid.test.ts.snap b/packages/core/src/__tests__/__snapshots__/solid.test.ts.snap index 152cfa6bed..52736d7bc1 100644 --- a/packages/core/src/__tests__/__snapshots__/solid.test.ts.snap +++ b/packages/core/src/__tests__/__snapshots__/solid.test.ts.snap @@ -3837,9 +3837,9 @@ function BasicForFragment(props) { {(option, _index) => { const index = _index(); return ( - + <>
{option}
-
+ ); }} @@ -3863,9 +3863,9 @@ function BasicForFragment(props) { {(option, _index) => { const index = _index(); return ( - + <>
{option}
-
+ ); }} @@ -12165,9 +12165,9 @@ function BasicForFragment(props: any) { {(option, _index) => { const index = _index(); return ( - + <>
{option}
-
+ ); }} @@ -12191,9 +12191,9 @@ function BasicForFragment(props: any) { {(option, _index) => { const index = _index(); return ( - + <>
{option}
-
+ ); }} diff --git a/packages/core/src/generators/solid/blocks.ts b/packages/core/src/generators/solid/blocks.ts index b0d0c71729..3f6e2f0039 100644 --- a/packages/core/src/generators/solid/blocks.ts +++ b/packages/core/src/generators/solid/blocks.ts @@ -57,9 +57,9 @@ export const blockToSolid = ( let str = ''; - const isFragmentWithoutKey = json.name === 'Fragment' && !json.bindings.key; + const isFragment = json.name === 'Fragment'; - if (isFragmentWithoutKey) { + if (isFragment) { str += '<'; } else { str += `<${json.name} `; @@ -70,16 +70,20 @@ export const blockToSolid = ( } const classString = collectClassString(json, options); - if (classString) { + if (classString && !isFragment) { str += ` class=${classString} `; } for (const key in json.properties) { + if (isFragment) continue; + const value = json.properties[key]; const newKey = transformAttributeName(key); str += ` ${newKey}="${value}" `; } for (const key in json.bindings) { + if (isFragment) continue; + const { code, arguments: cusArg = ['event'], type } = json.bindings[key]!; if (!code) continue; @@ -130,7 +134,7 @@ export const blockToSolid = ( .join('\n'); } - if (isFragmentWithoutKey) { + if (isFragment) { str += ''; } else { str += ``;