mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #17422 from overleaf/jpa-avoid-resize-observer-loop
[web] avoid ResizeObserver loop when opening logs pane GitOrigin-RevId: fb9c54e137785b34af01d031e182b66969711e41
This commit is contained in:
parent
91b67bc0bd
commit
e100d85940
1 changed files with 2 additions and 1 deletions
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue