Skip to content

Commit

Permalink
🏃 (#1639)
Browse files Browse the repository at this point in the history
  • Loading branch information
samijaber authored Nov 12, 2024
1 parent 6c59a0c commit 7ae4a01
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/spicy-pens-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@builder.io/mitosis': patch
---

Fix: Solid fragments rendering by removing all props
16 changes: 8 additions & 8 deletions packages/core/src/__tests__/__snapshots__/solid.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3837,9 +3837,9 @@ function BasicForFragment(props) {
{(option, _index) => {
const index = _index();
return (
<Fragment key={\`key-\${option}\`}>
<>
<div>{option}</div>
</Fragment>
</>
);
}}
</For>
Expand All @@ -3863,9 +3863,9 @@ function BasicForFragment(props) {
{(option, _index) => {
const index = _index();
return (
<Fragment key={\`key-\${option}\`}>
<>
<div>{option}</div>
</Fragment>
</>
);
}}
</For>
Expand Down Expand Up @@ -12165,9 +12165,9 @@ function BasicForFragment(props: any) {
{(option, _index) => {
const index = _index();
return (
<Fragment key={\`key-\${option}\`}>
<>
<div>{option}</div>
</Fragment>
</>
);
}}
</For>
Expand All @@ -12191,9 +12191,9 @@ function BasicForFragment(props: any) {
{(option, _index) => {
const index = _index();
return (
<Fragment key={\`key-\${option}\`}>
<>
<div>{option}</div>
</Fragment>
</>
);
}}
</For>
Expand Down
12 changes: 8 additions & 4 deletions packages/core/src/generators/solid/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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} `;
Expand All @@ -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;

Expand Down Expand Up @@ -130,7 +134,7 @@ export const blockToSolid = (
.join('\n');
}

if (isFragmentWithoutKey) {
if (isFragment) {
str += '</>';
} else {
str += `</${json.name}>`;
Expand Down

0 comments on commit 7ae4a01

Please sign in to comment.