fix render

This commit is contained in:
Rizky 2023-10-31 14:13:13 +07:00
parent 3bab393c5d
commit 7e9efb848a
2 changed files with 8 additions and 18 deletions

View File

@ -1,5 +1,5 @@
import { FC, ReactNode, useEffect, useState } from "react";
import { useGlobal, useLocal } from "web-utils";
import { deepClone, useGlobal, useLocal } from "web-utils";
import { produceCSS } from "../../../utils/css/gen";
import { IContent } from "../../../utils/types/general";
import { FNAdv, FNCompDef, FNLinkTag } from "../../../utils/types/meta-fn";
@ -95,21 +95,10 @@ export const LRenderInternal: FC<{
let props = {} as Record<string, FNCompDef>;
let cprops = {} as [string, FNCompDef][];
if (meta.comp.mcomp) {
props = meta.comp.mcomp
.get("component")
?.get("props")
?.toJSON() as Record<string, FNCompDef>;
cprops = Object.entries(props).sort((a, b) => {
return a[1].idx - b[1].idx;
});
} else {
props = structuredClone(
p.comps.all[meta.comp.id]?.content_tree.component?.props || {}
);
cprops = Object.entries(props);
}
props = deepClone(
p.comps.all[meta.comp.id]?.content_tree.component?.props || {}
);
cprops = Object.entries(props);
comp.propval = treePropEval(p, id, cprops, _scopeIndex);
}

View File

@ -7,6 +7,7 @@ import { IRoot } from "../../../utils/types/root";
import { fillID } from "../../editor/tools/fill-id";
import { PG } from "./global";
import { PRASI_COMPONENT } from "../../../utils/types/render";
import { deepClone } from "web-utils";
export const scanComponent = (
item: IRoot | IContent,
@ -97,7 +98,7 @@ export const instantiateComp = (
}
target = mitem.toJSON();
} else {
target = structuredClone(mcomp.item.content_tree);
target = deepClone(mcomp.item.content_tree);
mprops = target.component.props || {};
}