diff --git a/.changeset/famous-boats-fetch.md b/.changeset/famous-boats-fetch.md new file mode 100644 index 0000000000..319da5ecd8 --- /dev/null +++ b/.changeset/famous-boats-fetch.md @@ -0,0 +1,5 @@ +--- +'@builder.io/mitosis': major +--- + +fix a bug 1330 diff --git a/packages/core/src/generators/solid/blocks.ts b/packages/core/src/generators/solid/blocks.ts index 71533a4d7f..99d5641c05 100644 --- a/packages/core/src/generators/solid/blocks.ts +++ b/packages/core/src/generators/solid/blocks.ts @@ -49,12 +49,7 @@ export const blockToSolid = ({ } let str = ''; - - if (json.name === 'Fragment') { - str += '<'; - } else { - str += `<${json.name} `; - } + str += `<${json.name} `; if (json.name === 'Show' && json.meta.else) { str += `fallback={${blockToSolid({ component, json: json.meta.else as any, options })}}`; @@ -115,16 +110,19 @@ export const blockToSolid = ({ str += '>'; if (json.children) { str += json.children + .map((item) => { + const Fragment = item.children.find((item) => item.name === 'Fragment'); + if (Fragment) { + item.children = [...Fragment.children]; + } + return item; + }) .filter(filterEmptyTextNodes) .map((item) => blockToSolid({ component, json: item, options })) .join('\n'); } - - if (json.name === 'Fragment') { - str += ''; - } else { - str += ``; - } + // A -> F + str += ``; return str; };