diff --git a/app/web/src/nova/vi/render/script/eval-prop.tsx b/app/web/src/nova/vi/render/script/eval-prop.tsx index e65d6245..0e17cd1c 100644 --- a/app/web/src/nova/vi/render/script/eval-prop.tsx +++ b/app/web/src/nova/vi/render/script/eval-prop.tsx @@ -155,13 +155,6 @@ export const viEvalProps = ( val = (...args: any[]) => { return meta.item.script?.props?.[name].fn(...args); }; - // val = new Function( - // `// [${meta.item.name}] ${name}: ${meta.item.id} - // const { ${Object.keys(arg).join(", ")} } = this; - // const fn = ${val.toString()} - // return fn(...arguments); - // ` - // ).bind(arg); } arg[name] = val; diff --git a/app/web/src/utils/sync/ws-client.ts b/app/web/src/utils/sync/ws-client.ts index 7b36f414..de0c9b9b 100644 --- a/app/web/src/utils/sync/ws-client.ts +++ b/app/web/src/utils/sync/ws-client.ts @@ -165,9 +165,10 @@ const connect = ( `${url.protocol}//${url.host}${url.pathname}` ); - const timeout = setTimeout(() => { + let timeout = setTimeout(() => { + clearTimeout(timeout); ws.close(); - retry(); + retry(); }, 2000); ws.onopen = () => { @@ -179,20 +180,7 @@ const connect = ( conf.ws = ws; event.opened(); }; - ws.onclose = async () => { - w.offline = true; - w.editorRender?.(); - - const res = event.disconnected(); - if (res.reconnect) { - setTimeout(async () => { - reconnect++; - retry(); - }, reconnect * WS_CONFIG.reconnectTimeout); - } else { - reject(); - } - }; + ws.onmessage = async (e) => { const raw = e.data as Blob; const msg = packr.unpack(Buffer.from(await raw.arrayBuffer()));