fix children rendering

This commit is contained in:
Rizky 2024-08-18 14:09:35 +07:00
parent 7a2b2adc23
commit 1acd89613a
5 changed files with 14 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@ -175,6 +175,7 @@ export const Root = () => {
}
// #endregion
return (
<Provider value={w.prasiContext}>
<div

View File

@ -69,7 +69,10 @@ export const ViRender: FC<{
console.log(spaces + meta.item.id, meta.item.name);
}
if (meta.item.adv?.js || meta.item.component?.id) {
if (
!(is_layout && meta.item.name === "children") &&
(meta.item.adv?.js || meta.item.component?.id)
) {
return (
<ErrorBox meta={meta}>
<ViScript
@ -82,6 +85,7 @@ export const ViRender: FC<{
</ErrorBox>
);
}
return (
<ErrorBox meta={meta}>
<ViChild
@ -106,6 +110,7 @@ export const ViChild: FC<{
if (is_layout && meta.item.name === "children") {
const childs: ReactNode[] = [];
for (const item_id of vi.entry) {
const meta = vi.meta[item_id];

View File

@ -33,13 +33,11 @@ export const ViRoot: FC<{}> = ({}) => {
entry.map((id) => {
const meta = is_layout ? vi.layout?.meta[id] : vi.meta[id];
if (meta) {
if (Element) {
return (
<ErrorBox key={meta.item.id}>
<ViRender meta={meta} is_layout={is_layout} depth={0} />
</ErrorBox>
);
}
return (
<ErrorBox key={meta.item.id}>
<ViRender meta={meta} is_layout={is_layout} depth={0} />
</ErrorBox>
);
}
return null;
})}

View File

@ -109,6 +109,7 @@ export const Vi: FC<{
((url: string) => {
false;
});
w.preload = (_urls: PRELOAD_ARGS["urls"], opt: PRELOAD_ARGS["opt"]) => {
if (vi.on_preload) {
return new Promise<void>((done) => {