wip fix
This commit is contained in:
parent
d997fbbaaa
commit
5d946f53a1
|
|
@ -106,7 +106,7 @@ export const page_load: SAction["page"]["load"] = async function (
|
||||||
url: page.url,
|
url: page.url,
|
||||||
name: page.name,
|
name: page.name,
|
||||||
snapshot: await gzipAsync(bin),
|
snapshot: await gzipAsync(bin),
|
||||||
comps: await prepareComponentForPage(id, this, false),
|
comps: (await prepareComponentForPage(id, this, false)) || {},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} else if (snap && !ydoc) {
|
} else if (snap && !ydoc) {
|
||||||
|
|
@ -140,7 +140,7 @@ export const page_load: SAction["page"]["load"] = async function (
|
||||||
url: snap.url,
|
url: snap.url,
|
||||||
name: snap.name,
|
name: snap.name,
|
||||||
snapshot: await gzipAsync(snap.bin),
|
snapshot: await gzipAsync(snap.bin),
|
||||||
comps,
|
comps: comps || {},
|
||||||
};
|
};
|
||||||
} else if (snap && ydoc) {
|
} else if (snap && ydoc) {
|
||||||
user.active.add({
|
user.active.add({
|
||||||
|
|
@ -156,7 +156,7 @@ export const page_load: SAction["page"]["load"] = async function (
|
||||||
url: snap.url,
|
url: snap.url,
|
||||||
name: snap.name,
|
name: snap.name,
|
||||||
snapshot: await gzipAsync(snap.bin),
|
snapshot: await gzipAsync(snap.bin),
|
||||||
comps: await prepareComponentForPage(id, this, true),
|
comps: (await prepareComponentForPage(id, this, true)) || {},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -16,26 +16,31 @@ export const prepareComponentForPage = async (
|
||||||
const _doc = doc ? doc : docs.page[page_id].doc;
|
const _doc = doc ? doc : docs.page[page_id].doc;
|
||||||
const root = _doc.getMap("map").get("root")?.toJSON() as IRoot;
|
const root = _doc.getMap("map").get("root")?.toJSON() as IRoot;
|
||||||
|
|
||||||
const result = {} as Record<string, EComp>;
|
if (root) {
|
||||||
|
const result = {} as Record<string, EComp>;
|
||||||
|
|
||||||
if (reload_components) {
|
if (reload_components) {
|
||||||
root.component_ids = await loadCompForPage(root, sync);
|
root.component_ids = await loadCompForPage(root, sync);
|
||||||
if (doc) {
|
if (doc) {
|
||||||
_doc.getMap("map").get("root")?.set("component_ids", root.component_ids);
|
_doc
|
||||||
}
|
.getMap("map")
|
||||||
}
|
.get("root")
|
||||||
|
?.set("component_ids", root.component_ids);
|
||||||
if (root.component_ids) {
|
|
||||||
for (const id of root.component_ids) {
|
|
||||||
if (!docs.comp[id]) {
|
|
||||||
await loadComponent(id, sync);
|
|
||||||
}
|
|
||||||
const snap = snapshot.get("comp", id);
|
|
||||||
if (snap) {
|
|
||||||
result[id] = { id, snapshot: await gzipAsync(snap.bin) };
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
if (root.component_ids) {
|
||||||
|
for (const id of root.component_ids) {
|
||||||
|
if (!docs.comp[id]) {
|
||||||
|
await loadComponent(id, sync);
|
||||||
|
}
|
||||||
|
const snap = snapshot.get("comp", id);
|
||||||
|
if (snap) {
|
||||||
|
result[id] = { id, snapshot: await gzipAsync(snap.bin) };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue