Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(link): prefetch routes #1568

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion next-tavla/app/(admin)/components/HorizontalNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,27 @@ function HorizontalNavBar({ loggedIn }: { loggedIn: boolean }) {
if (!loggedIn) return null
return (
<div className="flex-row hidden md:flex gap-4">
<IconButton as={Link} href="?board=name" className="gap-4 p-4">
<IconButton
as={Link}
href="?board=name"
className="gap-4 p-4"
prefetch={true}
>
<AddIcon /> Opprett tavle <CreateBoard />
</IconButton>
<TopNavigationItem
active={pathname?.includes('/boards')}
as={Link}
href="/boards"
prefetch={true}
>
Tavler
</TopNavigationItem>
<TopNavigationItem
active={pathname?.includes('/organizations')}
as={Link}
href="/organizations"
prefetch={true}
>
Organisasjoner
</TopNavigationItem>
Expand Down
14 changes: 12 additions & 2 deletions next-tavla/app/(admin)/components/SideNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,36 @@ function SideNavBar({ loggedIn }: { loggedIn: boolean }) {
>
<SideNavigation className="h-full pt-10">
<div className="pl-10">
<Link href="/" aria-label="Tilbake til landingssiden">
<Link
href="/"
aria-label="Tilbake til landingssiden"
prefetch={true}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trenger man prefetch her? Nesten hele siden er vel statisk uansett, så vet ikke hvor mye det gir å prefetche den

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kan verr enig i det.

>
<Image src={TavlaLogoBlue} height={22} alt="" />
</Link>
<Heading2 className="mt-16 mb-4">Meny</Heading2>
</div>

<div className="bg-secondary">
<SideNavigationItem as={Link} href="?board=name">
<SideNavigationItem
as={Link}
href="?board=name"
prefetch={true}
>
Opprett tavle
<CreateBoard />
</SideNavigationItem>
<SideNavigationItem
href="/boards"
active={pathname?.includes('/boards')}
prefetch={true}
>
Tavler
</SideNavigationItem>
<SideNavigationItem
href="/organizations"
active={pathname?.includes('/organizations')}
prefetch={true}
>
Organisasjoner
</SideNavigationItem>
Expand Down