From 96a0c5c4b0a1dcf8ef60e28ff87ff793e33ac203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi?= Date: Sun, 5 Jan 2025 03:19:22 +0100 Subject: [PATCH] fix: update dependencies in useEffect hooks and improve router usage in SidebarItem --- src/app/components/Header/index.tsx | 1 + src/app/components/Room/Table.tsx | 2 +- src/app/components/Sidebar/item.tsx | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/components/Header/index.tsx b/src/app/components/Header/index.tsx index d0273af..5b5561c 100644 --- a/src/app/components/Header/index.tsx +++ b/src/app/components/Header/index.tsx @@ -45,6 +45,7 @@ export const Header = ({ user }: { user?: User }) => { fetchClass().then(() => { if (selectedClass) setSelectedClass(classes[0]); }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( diff --git a/src/app/components/Room/Table.tsx b/src/app/components/Room/Table.tsx index 48bb44d..bcf0f56 100644 --- a/src/app/components/Room/Table.tsx +++ b/src/app/components/Room/Table.tsx @@ -10,7 +10,7 @@ export const RoomTable = () => { useEffect(() => { fetchRooms(); - }, [selectedClass]); + }, [fetchRooms, selectedClass]); return (
diff --git a/src/app/components/Sidebar/item.tsx b/src/app/components/Sidebar/item.tsx index fc681ec..5eb3d1e 100644 --- a/src/app/components/Sidebar/item.tsx +++ b/src/app/components/Sidebar/item.tsx @@ -11,9 +11,11 @@ export const SidebarItem = ({ icon: React.ReactNode; href: string; }) => { + const router = useRouter(); + return ( useRouter().push(href)} + onPress={() => router.push(href)} color="foreground" className="w-full px-2 py-1 gap-2" >