Skip to content

Commit

Permalink
fix: disable prefetch for logout route
Browse files Browse the repository at this point in the history
  • Loading branch information
samderanova committed Dec 16, 2023
1 parent 5c5ae29 commit e4f47c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/site/src/lib/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,30 @@ import type { ComponentProps } from "react";
import Link from "next/link";
import styles from "./Button.module.css";
import clsx from "clsx";
import { disableInstantTransitions } from "framer-motion";

interface ButtonProps {
text: string;
className?: string;
href?: ComponentProps<typeof Link>["href"];
isLightVersion?: boolean;
usePrefetch?: boolean;
}

const Button: React.FC<ButtonProps> = ({
text,
href,
className,
isLightVersion,
usePrefetch
}) => {
if (href) {
return (
<Link
href={href}
target={isLightVersion ? "" : "_blank"}
rel="noopener noreferrer"
prefetch={usePrefetch}
className={clsx(
styles.button,
isLightVersion && styles.lightButton,
Expand Down
1 change: 1 addition & 0 deletions apps/site/src/lib/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ function Navbar({ identity }: NavbarProps) {
<Button
text="Logout"
href="/api/user/logout"
usePrefetch={false}
isLightVersion
/>
)}
Expand Down

0 comments on commit e4f47c5

Please sign in to comment.