fix: update dependencies in useEffect hooks and improve router usage in SidebarItem
This commit is contained in:
parent
ff82486134
commit
96a0c5c4b0
@ -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 (
|
||||
|
@ -10,7 +10,7 @@ export const RoomTable = () => {
|
||||
|
||||
useEffect(() => {
|
||||
fetchRooms();
|
||||
}, [selectedClass]);
|
||||
}, [fetchRooms, selectedClass]);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
|
@ -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"
|
||||
>
|
||||
|
Loading…
Reference in New Issue
Block a user