Skip to content

Commit

Permalink
chore: set exhaustive deps eslint rule to error (#4207)
Browse files Browse the repository at this point in the history
and fix the warnings in devtools
  • Loading branch information
TkDodo authored Sep 22, 2022
1 parent 6f59bbd commit 7f8d4a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"import/no-cycle": "error",
"import/no-unresolved": ["error", { "ignore": ["^@tanstack\/"] }],
"import/no-unused-modules": ["off", { "unusedExports": true }],
"no-redeclare": "off"
"no-redeclare": "off",
"react-hooks/exhaustive-deps": "error"
}
}
14 changes: 6 additions & 8 deletions packages/react-query-devtools/src/devtools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,13 @@ export function ReactQueryDevtools({

React.useEffect(() => {
if (isResolvedOpen) {
const previousValue = rootRef.current?.parentElement?.style.paddingBottom
const root = rootRef.current
const previousValue = root?.parentElement?.style.paddingBottom

const run = () => {
const containerHeight = panelRef.current?.getBoundingClientRect().height
if (rootRef.current?.parentElement) {
rootRef.current.parentElement.style.paddingBottom = `${containerHeight}px`
if (root?.parentElement) {
root.parentElement.style.paddingBottom = `${containerHeight}px`
}
}

Expand All @@ -208,11 +209,8 @@ export function ReactQueryDevtools({

return () => {
window.removeEventListener('resize', run)
if (
rootRef.current?.parentElement &&
typeof previousValue === 'string'
) {
rootRef.current.parentElement.style.paddingBottom = previousValue
if (root?.parentElement && typeof previousValue === 'string') {
root.parentElement.style.paddingBottom = previousValue
}
}
}
Expand Down

0 comments on commit 7f8d4a0

Please sign in to comment.