mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-03 12:41:45 +02:00
fix: crash in editor due to ResizeObserver loop limit exceeded
This commit is contained in:
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user