From e28f7e3ec1bcd8b6a824a31566ea5eb73f3f45b9 Mon Sep 17 00:00:00 2001 From: Rizky Date: Tue, 25 Jun 2024 08:21:22 +0700 Subject: [PATCH] fix --- app/srv/ws/sync/actions/code_edit.ts | 14 +++----------- app/web/src/nova/ed/logic/ed-route.ts | 4 +++- .../ed/panel/side/prop-instance/prop-option.tsx | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/app/srv/ws/sync/actions/code_edit.ts b/app/srv/ws/sync/actions/code_edit.ts index ac7388ae..45051660 100644 --- a/app/srv/ws/sync/actions/code_edit.ts +++ b/app/srv/ws/sync/actions/code_edit.ts @@ -1,26 +1,18 @@ import { TransformResult, transform } from "esbuild"; import { g } from "utils/global"; +import { validate } from "uuid"; import { Doc } from "yjs"; import { MContent } from "../../../../web/src/utils/types/general"; import { MItem } from "../../../../web/src/utils/types/item"; import { MRoot } from "../../../../web/src/utils/types/root"; import { SAction } from "../actions"; +import { loadComponent } from "../editor/load-component"; +import { parseJs } from "../editor/parser/parse-js"; 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"; -import { validate } from "uuid"; -import { gzipAsync } from "utils/diff/diff"; -import { user } from "../entity/user"; -import { loadComponent } from "../editor/load-component"; const decoder = new TextDecoder(); -const timeout = { - page: {} as Record, - comp: {} as Record, -}; - export const code_edit: SAction["code"]["edit"] = async function ( this: SyncConnection, arg diff --git a/app/web/src/nova/ed/logic/ed-route.ts b/app/web/src/nova/ed/logic/ed-route.ts index 79f38af0..691e68cd 100644 --- a/app/web/src/nova/ed/logic/ed-route.ts +++ b/app/web/src/nova/ed/logic/ed-route.ts @@ -7,7 +7,7 @@ import { treeCacheBuild, treeRebuild } from "./tree/build"; import { get, set } from "idb-keyval"; import { nav } from "../../vi/render/script/extract-nav"; -const UPDATE_TIMEOUT = 200; +const UPDATE_TIMEOUT = 0; export const edRoute = async (p: PG) => { if (p.sync && (p.status === "ready" || p.status === "init")) { if (!p.site.domain && !p.site.name) { @@ -71,6 +71,7 @@ export const reloadLayout = async (p: PG, layout_id: string, note: string) => { clearTimeout(page.update_timeout); page.update_timeout = setTimeout(async () => { if (origin === "local" || !p.sync) return; + console.log("page on update snap") const res = await p.sync.yjs.sv_local( "page", @@ -184,6 +185,7 @@ export const reloadPage = async ( return; } + console.log("page on update", origin) const res = await p.sync.yjs.sv_local( "page", p.page.cur.id, diff --git a/app/web/src/nova/ed/panel/side/prop-instance/prop-option.tsx b/app/web/src/nova/ed/panel/side/prop-instance/prop-option.tsx index f610b82f..1a39a2ba 100644 --- a/app/web/src/nova/ed/panel/side/prop-instance/prop-option.tsx +++ b/app/web/src/nova/ed/panel/side/prop-instance/prop-option.tsx @@ -227,7 +227,7 @@ export const EdPropInstanceOptions: FC<{ } }); }, - [local.open] + [local.open, mprop, config?.opt] ); let mode = cprop.meta?.option_mode;