From ea3e36eb7b2a7db1ac41e1a9cc685dcd08f71215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=A6Ltorio?= Date: Wed, 6 Nov 2024 17:08:26 +0100 Subject: [PATCH] debug resizeobserver --- src/aipane/components/Aipane.tsx | 7 ++++--- src/aipane/components/Header.tsx | 7 ++++--- src/aipane/components/HeroApiKey.tsx | 7 ++++--- src/aipane/components/HeroComboPrompts.tsx | 7 ++++--- src/aipane/components/HeroModels.tsx | 7 ++++--- src/aipane/components/HeroProviders.tsx | 7 ++++--- src/aipane/components/TextInsertion.tsx | 7 ++++--- 7 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/aipane/components/Aipane.tsx b/src/aipane/components/Aipane.tsx index fc09630..bffd4e8 100644 --- a/src/aipane/components/Aipane.tsx +++ b/src/aipane/components/Aipane.tsx @@ -219,12 +219,13 @@ const Aipane: React.FC = (props: AipaneProps): React.JSX.Element => console.error("ResizeObserver loop error in Aipane"); e.stopImmediatePropagation(); e.stopPropagation(); + e.preventDefault(); } }; window.addEventListener("error", resizeObserverErr); - return () => { - window.removeEventListener("error", resizeObserverErr); - }; + // return () => { + // window.removeEventListener("error", resizeObserverErr); + // }; }, []); return ( diff --git a/src/aipane/components/Header.tsx b/src/aipane/components/Header.tsx index 5e40c39..970d6f0 100644 --- a/src/aipane/components/Header.tsx +++ b/src/aipane/components/Header.tsx @@ -39,12 +39,13 @@ const Header: React.FC = (props: HeaderProps) => { console.error("ResizeObserver loop error in Header"); e.stopImmediatePropagation(); e.stopPropagation(); + e.preventDefault(); } }; window.addEventListener("error", resizeObserverErr); - return () => { - window.removeEventListener("error", resizeObserverErr); - }; + // return () => { + // window.removeEventListener("error", resizeObserverErr); + // }; }, []); return ( diff --git a/src/aipane/components/HeroApiKey.tsx b/src/aipane/components/HeroApiKey.tsx index 0f2282d..760eef5 100644 --- a/src/aipane/components/HeroApiKey.tsx +++ b/src/aipane/components/HeroApiKey.tsx @@ -40,12 +40,13 @@ const HeroApiKey: React.FC = ({ apiKey, onApiKeyChange, onApiKe console.error("ResizeObserver loop error in HeroApiKey"); e.stopImmediatePropagation(); e.stopPropagation(); + e.preventDefault(); } }; window.addEventListener("error", resizeObserverErr); - return () => { - window.removeEventListener("error", resizeObserverErr); - }; + // return () => { + // window.removeEventListener("error", resizeObserverErr); + // }; }, []); return ( diff --git a/src/aipane/components/HeroComboPrompts.tsx b/src/aipane/components/HeroComboPrompts.tsx index ff25219..f79b421 100644 --- a/src/aipane/components/HeroComboPrompts.tsx +++ b/src/aipane/components/HeroComboPrompts.tsx @@ -93,12 +93,13 @@ const HeroComboPrompts: React.FC = ({ onChange, standalon console.error("ResizeObserver loop error in HeroComboPrompts"); e.stopImmediatePropagation(); e.stopPropagation(); + e.preventDefault(); } }; window.addEventListener("error", resizeObserverErr); - return () => { - window.removeEventListener("error", resizeObserverErr); - }; + // return () => { + // window.removeEventListener("error", resizeObserverErr); + // }; }, []); return ( diff --git a/src/aipane/components/HeroModels.tsx b/src/aipane/components/HeroModels.tsx index 917484d..2a0e761 100644 --- a/src/aipane/components/HeroModels.tsx +++ b/src/aipane/components/HeroModels.tsx @@ -54,12 +54,13 @@ const HeroModels: React.FC = ({ onChange, provider }) => { console.error("ResizeObserver loop error in HeroModels"); e.stopImmediatePropagation(); e.stopPropagation(); + e.preventDefault(); } }; window.addEventListener("error", resizeObserverErr); - return () => { - window.removeEventListener("error", resizeObserverErr); - }; + // return () => { + // window.removeEventListener("error", resizeObserverErr); + // }; }, []); return ( diff --git a/src/aipane/components/HeroProviders.tsx b/src/aipane/components/HeroProviders.tsx index 5e1c842..36d7604 100644 --- a/src/aipane/components/HeroProviders.tsx +++ b/src/aipane/components/HeroProviders.tsx @@ -44,12 +44,13 @@ const HeroProviders: React.FC = ({ onChange }) => { console.error("ResizeObserver loop error in HeroProviders"); e.stopImmediatePropagation(); e.stopPropagation(); + e.preventDefault(); } }; window.addEventListener("error", resizeObserverErr); - return () => { - window.removeEventListener("error", resizeObserverErr); - }; + // return () => { + // window.removeEventListener("error", resizeObserverErr); + // }; }, []); const handleChange = React.useCallback( diff --git a/src/aipane/components/TextInsertion.tsx b/src/aipane/components/TextInsertion.tsx index 9afd5a0..95dc5e0 100644 --- a/src/aipane/components/TextInsertion.tsx +++ b/src/aipane/components/TextInsertion.tsx @@ -150,12 +150,13 @@ const TextInsertion: React.FC = (props: TextInsertionProps): console.error("ResizeObserver loop error in TextInsertion"); e.stopImmediatePropagation(); e.stopPropagation(); + e.preventDefault(); } }; window.addEventListener("error", resizeObserverErr); - return () => { - window.removeEventListener("error", resizeObserverErr); - }; + // return () => { + // window.removeEventListener("error", resizeObserverErr); + // }; }, []); return (