Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: crash in editor due to ResizeObserver loop limit exceeded

thecodrrab6b3b6ba2ed
diff --git a/apps/web/src/components/editor/titlebox.js b/apps/web/src/components/editor/titlebox.js
index 7a22127f2..88c932633 100644
--- a/apps/web/src/components/editor/titlebox.js
+++ b/apps/web/src/components/editor/titlebox.js
@@ -18,12 +18,18 @@ function TitleBox(props) {
}, []);
useEffect(() => {
+ console.log("hello");
if (!window.ResizeObserver) return;
const myObserver = new ResizeObserver((entries) => {
- const newHeight = entries[0].contentRect.height;
- setHeight(newHeight > 60 ? newHeight : 60);
+ window.requestAnimationFrame(() => {
+ const newHeight = entries[0].contentRect.height;
+ setHeight(newHeight > 60 ? newHeight : 60);
+ });
});
myObserver.observe(document.querySelector(".dummyEditorTitle"));
+ return () => {
+ myObserver.disconnect();
+ };
}, []);
useEffect(() => {