From a6ecc2728beada18e6ea2f7cc9ba4f8d28ebe46d Mon Sep 17 00:00:00 2001 From: Sawyer Hood Date: Tue, 4 Jun 2024 11:45:21 -0700 Subject: [PATCH] Fix potential infinite loop --- components/BrowserShape.tsx | 1 + components/Canvas.tsx | 20 -------------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/components/BrowserShape.tsx b/components/BrowserShape.tsx index f10f6a2..ea83cce 100644 --- a/components/BrowserShape.tsx +++ b/components/BrowserShape.tsx @@ -377,6 +377,7 @@ export class BrowserShapeUtil extends BaseBoxShapeUtil { name={`iframe-1-${shape.id}`} id={`iframe-1-${shape.id}`} onLoad={(e) => { + if (!isLoading) return; const iframe = e.target as HTMLIFrameElement; const html = iframe.contentDocument?.documentElement.outerHTML; if (html === ``) { diff --git a/components/Canvas.tsx b/components/Canvas.tsx index 00f7218..e2b6d07 100644 --- a/components/Canvas.tsx +++ b/components/Canvas.tsx @@ -49,26 +49,6 @@ function UI() { } }, [editor]); - // useEffect(() => { - // const unlisten = editor.store.listen( - // (update) => { - // for (const record of Object.values(update.changes.added)) { - // if (record.typeName === "shape" && record.type === "text") { - // editor.updateShape({ - // id: record.id, - // type: record.type, - // meta: { - // prompt: true, - // }, - // }); - // } - // } - // }, - // { scope: "document", source: "user" } - // ); - // return unlisten; - // }, [editor]); - return ( <>