Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug #1388

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

fix bug #1388

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/famous-boats-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@builder.io/mitosis': major
---

fix a bug 1330
22 changes: 10 additions & 12 deletions packages/core/src/generators/solid/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })}}`;
Expand Down Expand Up @@ -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 += `</${json.name}>`;
}
// A -> F
str += `</${json.name}>`;

return str;
};