From 3e1d2f46c7d0b1e760c9248efadaa0c09c11451c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=A6Ltorio?= Date: Wed, 6 Nov 2024 16:55:25 +0100 Subject: [PATCH] catch resizeObserver --- src/aipane/index.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/aipane/index.tsx b/src/aipane/index.tsx index 0f46ae4..78effac 100644 --- a/src/aipane/index.tsx +++ b/src/aipane/index.tsx @@ -48,6 +48,17 @@ const router = createBrowserRouter( /* Render application after Office initializes */ Office.onReady(() => { + const resizeObserver = new ResizeObserver((entries) => { + // We wrap it in requestAnimationFrame to avoid this error - ResizeObserver loop limit exceeded + window.requestAnimationFrame(() => { + if (!Array.isArray(entries) || !entries.length) { + return; + } + // your code + }); + }); + resizeObserver.observe(document.body); + root?.render(