Skip to content

Commit

Permalink
catch resizeObserver
Browse files Browse the repository at this point in the history
  • Loading branch information
aeltorio committed Nov 6, 2024
1 parent 1cc94a4 commit 3e1d2f4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/aipane/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<FluentProvider theme={webLightTheme}>
<React.StrictMode>
Expand Down

0 comments on commit 3e1d2f4

Please sign in to comment.