From e44d5b789ea0ec4aff7cc0348db2595907aa12d3 Mon Sep 17 00:00:00 2001 From: vwh Date: Wed, 6 Nov 2024 21:32:14 +0300 Subject: [PATCH] fix: fix missing hooks dependencies --- src/components/database/table-operations.tsx | 2 +- src/components/landing/dropzone.tsx | 2 +- src/components/landing/url-fetch.tsx | 2 +- src/components/settings/theme-mode-toggle.tsx | 6 ++++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/database/table-operations.tsx b/src/components/database/table-operations.tsx index 0989a5a..50e31e6 100644 --- a/src/components/database/table-operations.tsx +++ b/src/components/database/table-operations.tsx @@ -29,7 +29,7 @@ export function TableFilter({ columnName }: { columnName: string }) { setInputValue(""); setFiltersNeedClear(false); } - }, [filtersNeedClear]); + }, [filtersNeedClear, setFiltersNeedClear]); const handleFilterChange = useCallback( (e: React.ChangeEvent) => { diff --git a/src/components/landing/dropzone.tsx b/src/components/landing/dropzone.tsx index ec4abce..642c408 100644 --- a/src/components/landing/dropzone.tsx +++ b/src/components/landing/dropzone.tsx @@ -55,7 +55,7 @@ export default function UploadFile() { } } }, - [loadDatabaseBytes] + [loadDatabaseBytes, setDatabaseData] ); const { getRootProps, getInputProps, isDragActive } = useDropzone({ diff --git a/src/components/landing/url-fetch.tsx b/src/components/landing/url-fetch.tsx index 9e44bc2..0645b9f 100644 --- a/src/components/landing/url-fetch.tsx +++ b/src/components/landing/url-fetch.tsx @@ -60,7 +60,7 @@ export default function UrlFetch() { setIsFetching(false); } }, - [loadDatabaseBytes] + [loadDatabaseBytes, setDatabaseData] ); // Fetch database on page load if url in url params diff --git a/src/components/settings/theme-mode-toggle.tsx b/src/components/settings/theme-mode-toggle.tsx index ff383af..addc1b3 100644 --- a/src/components/settings/theme-mode-toggle.tsx +++ b/src/components/settings/theme-mode-toggle.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState, useCallback, useMemo } from "react"; +import { useEffect, useState, useCallback, useMemo, memo } from "react"; import { Button } from "@/components/ui/button"; import { MoonIcon, SunIcon } from "lucide-react"; @@ -8,7 +8,7 @@ const ANIMATION_CLASS = "animate-circular-reveal"; type Theme = "light" | "dark"; -export default function ThemeModeToggle() { +function ThemeModeToggle() { const [theme, setTheme] = useState(() => { const savedTheme = localStorage.getItem(THEME_KEY) as Theme | null; const prefersDark = window.matchMedia( @@ -72,3 +72,5 @@ export default function ThemeModeToggle() { return MemoizedThemeButton; } + +export default memo(ThemeModeToggle);