Skip to content

Commit

Permalink
fix: fix missing hooks dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
vwh committed Nov 6, 2024
1 parent d59f152 commit e44d5b7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/database/table-operations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function TableFilter({ columnName }: { columnName: string }) {
setInputValue("");
setFiltersNeedClear(false);
}
}, [filtersNeedClear]);
}, [filtersNeedClear, setFiltersNeedClear]);

const handleFilterChange = useCallback(
(e: React.ChangeEvent<HTMLInputElement>) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/landing/dropzone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function UploadFile() {
}
}
},
[loadDatabaseBytes]
[loadDatabaseBytes, setDatabaseData]
);

const { getRootProps, getInputProps, isDragActive } = useDropzone({
Expand Down
2 changes: 1 addition & 1 deletion src/components/landing/url-fetch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function UrlFetch() {
setIsFetching(false);
}
},
[loadDatabaseBytes]
[loadDatabaseBytes, setDatabaseData]
);

// Fetch database on page load if url in url params
Expand Down
6 changes: 4 additions & 2 deletions src/components/settings/theme-mode-toggle.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -8,7 +8,7 @@ const ANIMATION_CLASS = "animate-circular-reveal";

type Theme = "light" | "dark";

export default function ThemeModeToggle() {
function ThemeModeToggle() {
const [theme, setTheme] = useState<Theme>(() => {
const savedTheme = localStorage.getItem(THEME_KEY) as Theme | null;
const prefersDark = window.matchMedia(
Expand Down Expand Up @@ -72,3 +72,5 @@ export default function ThemeModeToggle() {

return MemoizedThemeButton;
}

export default memo(ThemeModeToggle);

0 comments on commit e44d5b7

Please sign in to comment.