Skip to content

Commit 7f8d4a0

Browse files
authored
chore: set exhaustive deps eslint rule to error (TanStack#4207)
and fix the warnings in devtools
1 parent 6f59bbd commit 7f8d4a0

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"import/no-cycle": "error",
5050
"import/no-unresolved": ["error", { "ignore": ["^@tanstack\/"] }],
5151
"import/no-unused-modules": ["off", { "unusedExports": true }],
52-
"no-redeclare": "off"
52+
"no-redeclare": "off",
53+
"react-hooks/exhaustive-deps": "error"
5354
}
5455
}

packages/react-query-devtools/src/devtools.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,13 @@ export function ReactQueryDevtools({
192192

193193
React.useEffect(() => {
194194
if (isResolvedOpen) {
195-
const previousValue = rootRef.current?.parentElement?.style.paddingBottom
195+
const root = rootRef.current
196+
const previousValue = root?.parentElement?.style.paddingBottom
196197

197198
const run = () => {
198199
const containerHeight = panelRef.current?.getBoundingClientRect().height
199-
if (rootRef.current?.parentElement) {
200-
rootRef.current.parentElement.style.paddingBottom = `${containerHeight}px`
200+
if (root?.parentElement) {
201+
root.parentElement.style.paddingBottom = `${containerHeight}px`
201202
}
202203
}
203204

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

209210
return () => {
210211
window.removeEventListener('resize', run)
211-
if (
212-
rootRef.current?.parentElement &&
213-
typeof previousValue === 'string'
214-
) {
215-
rootRef.current.parentElement.style.paddingBottom = previousValue
212+
if (root?.parentElement && typeof previousValue === 'string') {
213+
root.parentElement.style.paddingBottom = previousValue
216214
}
217215
}
218216
}

0 commit comments

Comments
 (0)