fix reconnecting...

This commit is contained in:
Rizky 2024-07-12 19:43:40 +07:00
parent 6b5b8526ee
commit 309d616afe
2 changed files with 11 additions and 5 deletions

View File

@ -1,17 +1,17 @@
import { createRouter, RadixRouter } from "radix3";
import { compress, decompress } from "wasm-gzip"; import { compress, decompress } from "wasm-gzip";
import { deepClone } from "web-utils"; import { deepClone } from "web-utils";
import * as Y from "yjs"; import * as Y from "yjs";
import { registerSiteTypings } from "../../../utils/script/typings";
import { clientStartSync } from "../../../utils/sync/ws-client"; import { clientStartSync } from "../../../utils/sync/ws-client";
import { w } from "../../../utils/types/general"; import { w } from "../../../utils/types/general";
import { Loading } from "../../../utils/ui/loading"; import { Loading } from "../../../utils/ui/loading";
import { loadFrontEnd, loadTypings } from "./code-loader";
import { updateComponentMeta } from "./comp/load";
import { EmptySite, PG } from "./ed-global"; import { EmptySite, PG } from "./ed-global";
import { treeRebuild } from "./tree/build";
import { reloadPage } from "./ed-route"; import { reloadPage } from "./ed-route";
import { loadSite } from "./ed-site"; import { loadSite } from "./ed-site";
import { updateComponentMeta } from "./comp/load"; import { treeRebuild } from "./tree/build";
import { createRouter, RadixRouter } from "radix3";
import { loadCode, loadFrontEnd, loadTypings } from "./code-loader";
import { registerSiteTypings } from "../../../utils/script/typings";
const decoder = new TextDecoder(); const decoder = new TextDecoder();

View File

@ -165,7 +165,13 @@ const connect = (
`${url.protocol}//${url.host}${url.pathname}` `${url.protocol}//${url.host}${url.pathname}`
); );
const timeout = setTimeout(() => {
ws.close();
retry();
}, 2000);
ws.onopen = () => { ws.onopen = () => {
clearTimeout(timeout);
w.offline = false; w.offline = false;
w.editorRender?.(); w.editorRender?.();