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(() => {
|
fetchClass().then(() => {
|
||||||
if (selectedClass) setSelectedClass(classes[0]);
|
if (selectedClass) setSelectedClass(classes[0]);
|
||||||
});
|
});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -10,7 +10,7 @@ export const RoomTable = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchRooms();
|
fetchRooms();
|
||||||
}, [selectedClass]);
|
}, [fetchRooms, selectedClass]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-4">
|
<div className="flex flex-col gap-4">
|
||||||
|
@ -11,9 +11,11 @@ export const SidebarItem = ({
|
|||||||
icon: React.ReactNode;
|
icon: React.ReactNode;
|
||||||
href: string;
|
href: string;
|
||||||
}) => {
|
}) => {
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
onPress={() => useRouter().push(href)}
|
onPress={() => router.push(href)}
|
||||||
color="foreground"
|
color="foreground"
|
||||||
className="w-full px-2 py-1 gap-2"
|
className="w-full px-2 py-1 gap-2"
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user