mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Wrap useResizeObserver dependency in useCallback (#16972)
GitOrigin-RevId: fd4a10a2897878361a87bb02c5c6e8e6abfa8f26
This commit is contained in:
parent
ea4d63876a
commit
e9dbaf20b8
1 changed files with 9 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
|||
import { useState } from 'react'
|
||||
import { useCallback, useState } from 'react'
|
||||
import { useResizeObserver } from '../../../shared/hooks/use-resize-observer'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import classNames from 'classnames'
|
||||
|
@ -13,9 +13,14 @@ export default function PdfLogEntryRawContent({
|
|||
const [expanded, setExpanded] = useState(false)
|
||||
const [needsExpander, setNeedsExpander] = useState(false)
|
||||
|
||||
const { elementRef } = useResizeObserver(element => {
|
||||
setNeedsExpander(element.scrollHeight > collapsedSize)
|
||||
})
|
||||
const { elementRef } = useResizeObserver(
|
||||
useCallback(
|
||||
element => {
|
||||
setNeedsExpander(element.scrollHeight > collapsedSize)
|
||||
},
|
||||
[collapsedSize]
|
||||
)
|
||||
)
|
||||
|
||||
const { t } = useTranslation()
|
||||
|
||||
|
|
Loading…
Reference in a new issue