From a76da9d02b7f745dc8b10e4ceeadcc3011f0d008 Mon Sep 17 00:00:00 2001 From: Sami Jaber Date: Tue, 12 Nov 2024 10:13:21 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/spicy-pens-tease.md | 5 +++++ .../__tests__/__snapshots__/solid.test.ts.snap | 16 ++++++++-------- packages/core/src/generators/solid/blocks.ts | 12 ++++++++---- 3 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 .changeset/spicy-pens-tease.md 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 += ``;