From e100d85940392eb26992f86068f8391a88b9fac0 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Tue, 16 Apr 2024 09:36:45 +0100 Subject: [PATCH] Merge pull request #17422 from overleaf/jpa-avoid-resize-observer-loop [web] avoid ResizeObserver loop when opening logs pane GitOrigin-RevId: fb9c54e137785b34af01d031e182b66969711e41 --- .../pdf-preview/components/pdf-log-entry-raw-content.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/web/frontend/js/features/pdf-preview/components/pdf-log-entry-raw-content.jsx b/services/web/frontend/js/features/pdf-preview/components/pdf-log-entry-raw-content.jsx index ed4b6db34a..b8cc1c20a1 100644 --- a/services/web/frontend/js/features/pdf-preview/components/pdf-log-entry-raw-content.jsx +++ b/services/web/frontend/js/features/pdf-preview/components/pdf-log-entry-raw-content.jsx @@ -11,11 +11,12 @@ export default function PdfLogEntryRawContent({ collapsedSize = 0, }) { const [expanded, setExpanded] = useState(false) - const [needsExpander, setNeedsExpander] = useState(false) + const [needsExpander, setNeedsExpander] = useState(true) const { elementRef } = useResizeObserver( useCallback( element => { + if (element.scrollHeight === 0) return // skip update when logs-pane is closed setNeedsExpander(element.scrollHeight > collapsedSize) }, [collapsedSize]