fix: update dependencies in useEffect hooks and improve router usage in SidebarItem

This commit is contained in:
Rémi 2025-01-05 03:19:22 +01:00
parent ff82486134
commit 96a0c5c4b0
3 changed files with 5 additions and 2 deletions

View File

@ -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 (

View File

@ -10,7 +10,7 @@ export const RoomTable = () => {
useEffect(() => {
fetchRooms();
}, [selectedClass]);
}, [fetchRooms, selectedClass]);
return (
<div className="flex flex-col gap-4">

View File

@ -11,9 +11,11 @@ export const SidebarItem = ({
icon: React.ReactNode;
href: string;
}) => {
const router = useRouter();
return (
<Link
onPress={() => useRouter().push(href)}
onPress={() => router.push(href)}
color="foreground"
className="w-full px-2 py-1 gap-2"
>