From 3796bc6fd174310204502c805d2ccaa2651466a1 Mon Sep 17 00:00:00 2001 From: Cristiano Ventura Date: Thu, 26 Sep 2024 15:48:38 -0400 Subject: [PATCH] fix: eslint warnings in Recorder and useOverflowCheck (#229) --- .eslintrc.json | 3 +++ src/hooks/useOverflowCheck.ts | 9 +++++---- src/views/Recorder/Recorder.tsx | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index e8acb2ee..ba791ea8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -21,6 +21,9 @@ "ignorePatterns": ["resources/group_snippet.js"], "plugins": ["import", "unused-imports", "@tanstack/query"], "settings": { + "react": { + "version": "detect" + }, "import/resolver": { "typescript": {} } diff --git a/src/hooks/useOverflowCheck.ts b/src/hooks/useOverflowCheck.ts index 32878b65..2edb53a0 100644 --- a/src/hooks/useOverflowCheck.ts +++ b/src/hooks/useOverflowCheck.ts @@ -14,13 +14,14 @@ export function useOverflowCheck(ref: React.RefObject) { checkOverflow() const resizeObserver = new ResizeObserver(checkOverflow) - if (ref.current) { - resizeObserver.observe(ref.current) + const currentRef = ref.current + if (currentRef) { + resizeObserver.observe(currentRef) } return () => { - if (ref.current) { - resizeObserver.unobserve(ref.current) + if (currentRef) { + resizeObserver.unobserve(currentRef) } } }, [ref]) diff --git a/src/views/Recorder/Recorder.tsx b/src/views/Recorder/Recorder.tsx index 5f707585..daf2cfd2 100644 --- a/src/views/Recorder/Recorder.tsx +++ b/src/views/Recorder/Recorder.tsx @@ -165,7 +165,7 @@ export function Recorder() { } ) }) - }, [validateAndSaveHarFile, showToast]) + }, [validateAndSaveHarFile, showToast, navigate]) return (