fix scope

This commit is contained in:
Rizky 2023-10-24 11:24:07 +07:00
parent 8f5c20beeb
commit 1de068c000
5 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,5 @@
import { SyncConnection } from "../type";
export const site_group = async function (this: SyncConnection) {
console.log(this.user);
return "gruop";
};

View File

@ -78,7 +78,7 @@ export const Editor: FC<{ site_id: string; page_id: string; session: any }> = ({
useEffect(() => {
if (p.status !== "init" && w.prasiApi) {
for (const [k, v] of Object.entries(deepClone(EditorGlobal))) {
for (const [k, v] of Object.entries(EditorGlobal)) {
if (k === "session" || k === "site" || "status") continue;
(p as any)[k] = v;
}

View File

@ -67,8 +67,6 @@ export const treePropEval = (
parent_id: string;
_scopeIndex?: Record<string, string>;
}) => {
console.log(prop_name);
if (prop.content) {
const meta = p.treeMeta[prop.content.id];
if (meta) {

View File

@ -209,6 +209,14 @@ const createPassProp = (
const scopeIndex = { ..._existingScopeIndex, [meta.item.id]: arg.idx };
if (!meta.scope) {
meta.scope = {};
}
for (const [k, v] of Object.entries(arg)) {
if (k === "children") continue;
meta.scope[k] = v;
}
return modifyChildIndex(arg.children, scopeIndex);
}
@ -219,6 +227,7 @@ const createPassProp = (
if (k === "children") continue;
meta.scope[k] = v;
}
return arg.children;
};
};

View File

@ -43,7 +43,7 @@ export const useGlobal = <T extends object>(
const { global, render } = ctx;
if (!global[_id]) {
global[_id] = defaultValue;
global[_id] = structuredClone(defaultValue);
}
useEffect(() => {