wip fix
This commit is contained in:
parent
4bfdbef581
commit
a05d3af1a3
|
|
@ -9,8 +9,14 @@ import { docs } from "../entity/docs";
|
|||
import { gunzipAsync } from "../entity/zlib";
|
||||
import { SyncConnection } from "../type";
|
||||
import { parseJs } from "../editor/parser/parse-js";
|
||||
import { snapshot } from "../entity/snapshot";
|
||||
const decoder = new TextDecoder();
|
||||
|
||||
const timeout = {
|
||||
page: {} as Record<string, any>,
|
||||
comp: {} as Record<string, any>,
|
||||
};
|
||||
|
||||
export const code_edit: SAction["code"]["edit"] = async function (
|
||||
this: SyncConnection,
|
||||
arg
|
||||
|
|
@ -84,14 +90,14 @@ export const code_edit: SAction["code"]["edit"] = async function (
|
|||
});
|
||||
|
||||
if (save_to === "comp" && comp_id) {
|
||||
await db.component.update({
|
||||
db.component.update({
|
||||
where: { id: comp_id },
|
||||
data: {
|
||||
content_tree: root.toJSON(),
|
||||
},
|
||||
});
|
||||
} else if (page_id) {
|
||||
await db.page.update({
|
||||
db.page.update({
|
||||
where: { id: page_id },
|
||||
data: {
|
||||
content_tree: root.toJSON(),
|
||||
|
|
@ -121,14 +127,14 @@ export const code_edit: SAction["code"]["edit"] = async function (
|
|||
});
|
||||
|
||||
if (save_to === "comp" && comp_id) {
|
||||
await db.component.update({
|
||||
db.component.update({
|
||||
where: { id: comp_id },
|
||||
data: {
|
||||
content_tree: root.toJSON(),
|
||||
},
|
||||
});
|
||||
} else if (page_id) {
|
||||
await db.page.update({
|
||||
db.page.update({
|
||||
where: { id: page_id },
|
||||
data: {
|
||||
content_tree: root.toJSON(),
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ const viRoute = async (p: PG) => {
|
|||
|
||||
p.script.init_local_effect = {};
|
||||
|
||||
if (!w.isEditor) {
|
||||
if (!w.isEditor && p.page.cur.id !== params.page_id) {
|
||||
let page_cache = p.preview.meta_cache[params.page_id];
|
||||
|
||||
let should_render = false;
|
||||
|
|
|
|||
|
|
@ -86,10 +86,23 @@ export const ViChild: FC<{
|
|||
const childs: ReactNode[] = [];
|
||||
for (const item_id of vi.entry) {
|
||||
const meta = vi.meta[item_id];
|
||||
|
||||
if (meta.item.adv?.js || meta.item.component?.id) {
|
||||
childs.push(
|
||||
<ErrorBox meta={meta}>
|
||||
<ViScript
|
||||
meta={meta}
|
||||
is_layout={is_layout}
|
||||
passprop={passprop}
|
||||
></ViScript>
|
||||
</ErrorBox>
|
||||
);
|
||||
} else {
|
||||
const parts = viParts(vi, meta, false, passprop);
|
||||
if (vi.visit) vi.visit(meta, parts);
|
||||
childs.push(<div {...parts.props} />);
|
||||
}
|
||||
}
|
||||
return (
|
||||
<>
|
||||
{childs.map((e, idx) => (
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ export const ViRoot: FC<{}> = ({}) => {
|
|||
entry = vi.layout?.entry;
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<div className="flex flex-1 flex-col relative">
|
||||
{entry.map((id) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue