1
0
Fork 0
mirror of https://github.com/overleaf/overleaf.git synced 2025-03-22 02:04:31 +00:00

Merge pull request from overleaf/ae-eslint-hooks

Re-enable react-hooks/exhaustive-deps

GitOrigin-RevId: 2a767596d2cfd41b8bfbd3928dc43c266ec7dc0c
This commit is contained in:
Timothée Alby 2021-01-07 15:22:19 +01:00 committed by Copybot
parent 87d08c8fa8
commit aef02eb0a4
5 changed files with 8 additions and 13 deletions
services/web/frontend/js

View file

@ -30,8 +30,7 @@ function FileTreeRoot({
useEffect(() => {
if (isReady) onInit()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isReady])
}, [isReady, onInit])
if (!isReady) return null
return (

View file

@ -81,8 +81,7 @@ export function FileTreeSelectableProvider({
findInTree(fileTreeData, id)
)
onSelect(selectedEntities)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [fileTreeData, selectedEntityIds])
}, [fileTreeData, selectedEntityIds, onSelect])
useEffect(() => {
// listen for `editor.openDoc` and selected that doc

View file

@ -30,8 +30,7 @@ function OutlinePane({
useEffect(() => {
onToggle(isOpen)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isOpen])
}, [isOpen, onToggle])
const headerClasses = classNames('outline-pane', {
'outline-pane-disabled': !isTexFile

View file

@ -33,8 +33,7 @@ function useExpandCollapse({
})
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isExpanded])
}, [isExpanded, collapsedSize, dimension])
const expandableClasses = classNames(
'expand-collapse-container',

View file

@ -1,13 +1,13 @@
import { useLayoutEffect, useRef } from 'react'
import { useLayoutEffect, useRef, useCallback } from 'react'
function useResizeObserver(observedElement, observedData, callback) {
const resizeObserver = useRef()
function observe() {
const observe = useCallback(() => {
resizeObserver.current = new ResizeObserver(function(elementsObserved) {
callback(elementsObserved[0])
})
}
}, [callback])
function unobserve(observedCurrent) {
resizeObserver.current.unobserve(observedCurrent)
@ -30,8 +30,7 @@ function useResizeObserver(observedElement, observedData, callback) {
}
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [observedElement, observedData])
}, [observedElement, observedData, observe])
}
export default useResizeObserver