Skip to content

Commit

Permalink
SidebarFooter button: prefetch
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieujacq committed Oct 25, 2023
1 parent 9a78b04 commit 3e5828f
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useRouter } from "next/navigation";
import { useEffect } from "react";

type SidebarFooterButtonProps = {
icon: JSX.Element;
Expand All @@ -21,6 +22,12 @@ export const SidebarFooterButton = ({
};
}

useEffect(() => {
if (href !== undefined) {
void router.prefetch(href);
}
}, [href, router]);

return (
<button
type="button"
Expand Down

0 comments on commit 3e5828f

Please sign in to comment.