diff --git a/app/src/common/components/Link.tsx b/app/src/common/components/Link.tsx index 90cb8d97..26c0f82a 100644 --- a/app/src/common/components/Link.tsx +++ b/app/src/common/components/Link.tsx @@ -1,27 +1,23 @@ "use client"; import NextLink from "next/link"; -import { useRouter } from "next/navigation"; -import type { ComponentProps } from "react"; +import { useState, type ComponentProps } from "react"; type Props = ComponentProps; export const Link = (props: Props) => { - const { prefetch, href, onMouseEnter, ...rest } = props; - const router = useRouter(); + const { prefetch, onMouseEnter, ...rest } = props; + + const [_prefetch, setPrefetch] = useState( + prefetch === undefined ? false : prefetch, + ); - const _prefetch = prefetch === undefined ? false : prefetch; const _onMouseEnter = prefetch === undefined && onMouseEnter === undefined - ? () => router.prefetch(typeof href === "string" ? href : href.href) + ? () => setPrefetch(true) : onMouseEnter; return ( - + ); };