Skip to content

Commit c0f5172

Browse files
committed
fix for MUI nesting
1 parent f413aa1 commit c0f5172

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

app/src/components/main/DemoRender.tsx

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -134,24 +134,24 @@ const DemoRender = (): JSX.Element => {
134134
newProps.control = React.createElement(MaterialUI.Radio);
135135
}
136136
137-
if (type === 'TableBody') {
138-
console.log('Processing TableBody with rows:', rows);
139-
children = rows.map(row => {
140-
console.log('Processing row:', row);
141-
return {
142-
type: 'TableRow',
143-
props: { key: row.name },
144-
children: [
145-
{ type: 'TableCell', props: { component: 'th', scope: 'row' }, children: row.name },
146-
{ type: 'TableCell', props: { align: 'right' }, children: String(row.calories) },
147-
{ type: 'TableCell', props: { align: 'right' }, children: String(row.fat) },
148-
{ type: 'TableCell', props: { align: 'right' }, children: String(row.carbs) },
149-
{ type: 'TableCell', props: { align: 'right' }, children: String(row.protein) },
150-
]
151-
};
152-
});
153-
}
154-
console.log('post tableBody check', children);
137+
// if (type === 'TableBody') {
138+
// console.log('Processing TableBody with rows:', rows);
139+
// children = rows.map(row => {
140+
// console.log('Processing row:', row);
141+
// return {
142+
// type: 'TableRow',
143+
// props: { key: row.name },
144+
// children: [
145+
// { type: 'TableCell', props: { component: 'th', scope: 'row' }, children: row.name },
146+
// { type: 'TableCell', props: { align: 'right' }, children: String(row.calories) },
147+
// { type: 'TableCell', props: { align: 'right' }, children: String(row.fat) },
148+
// { type: 'TableCell', props: { align: 'right' }, children: String(row.carbs) },
149+
// { type: 'TableCell', props: { align: 'right' }, children: String(row.protein) },
150+
// ]
151+
// };
152+
// });
153+
// }
154+
// console.log('post tableBody check', children);
155155
156156
const processChildren = (child) => {
157157
if (typeof child === 'string') {
@@ -180,6 +180,12 @@ const DemoRender = (): JSX.Element => {
180180
if(segment.trim().startsWith('{') && segment.trim().endsWith('}')) {
181181
try {
182182
const jsonData = JSON.parse(segment);
183+
// console.log('jsonData', jsonData);
184+
if (jsonData.props && jsonData.props.children) {
185+
jsonData.children = jsonData.children || [];
186+
// console.log('jsonData.props.children', jsonData.props.children);
187+
jsonData.children = [...jsonData.children, ...jsonData.props.children];
188+
}
183189
const componentContainer = document.createElement('div');
184190
container.appendChild(componentContainer);
185191
const component = createComponentFromData(jsonData);

0 commit comments

Comments
 (0)