Skip to content

Commit

Permalink
disable link prefetching
Browse files Browse the repository at this point in the history
  • Loading branch information
kualta committed Jul 15, 2024
1 parent 9dcfcc4 commit 429013b
Show file tree
Hide file tree
Showing 20 changed files with 29 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/app/(sidebars)/error.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { ChevronLeftIcon, RotateCcwIcon } from "lucide-react";
import Link from "next/link";
import Link from "~/components/Link";
import { Button } from "~/components/ui/button";

export default function error({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/about/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react/no-unescaped-entities */
import { Cookie, FileIcon, Github } from "lucide-react";
import Link from "next/link";
import Link from "~/components/Link";
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "~/components/ui/accordion";
import { Button } from "~/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card";
Expand Down
2 changes: 1 addition & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AtSign, Github, Heart, InfoIcon, LogInIcon } from "lucide-react";
import Link from "next/link";
import { EmailSubscription } from "~/components/EmailSubscription";
import { LensTextDark, LensTextLight } from "~/components/Icons";
import Link from "~/components/Link";
import { ThemeToggle } from "~/components/ThemeToggle";
import { FadeIn } from "~/components/Transitions";
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "~/components/ui/accordion";
Expand Down
5 changes: 5 additions & 0 deletions src/components/Link.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import NextLink from 'next/link'

export default function Link(props) {
return <NextLink {...props} prefetch={props.prefetch ?? false}/>
}
2 changes: 1 addition & 1 deletion src/components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import { useSearchPublications } from "@lens-protocol/react-web";
import { ChevronLeft } from "lucide-react";
import Link from "next/link";
import { useSearchParams } from "next/navigation";
import { FeedSuspense } from "~/components/FeedSuspense";
import Link from "~/components/Link";
import { SearchBar } from "~/components/menu/Search";
import { lensItemToPost } from "~/components/post/Post";
import { Button } from "~/components/ui/button";
Expand Down
2 changes: 1 addition & 1 deletion src/components/communities/CommunityHandle.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Link from "next/link";
import Link from "~/components/Link";

export const CommunityHandle = ({ handle }: { handle: string }) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/communities/CommunityView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import Link from "next/link";
import Link from "~/components/Link";
import { Card } from "../ui/card";
import { type Community, getCommunityIcon } from "./Community";

Expand Down
2 changes: 1 addition & 1 deletion src/components/menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
UserIcon,
UsersIcon,
} from "lucide-react";
import Link from "next/link";
import Link from "~/components/Link";
import { Button } from "~/components/ui/button";
import { getLensClient } from "~/utils/getLensClient";
import { ServerSignedIn } from "../auth/ServerSignedIn";
Expand Down
2 changes: 1 addition & 1 deletion src/components/menu/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import {
TrendingUpIcon,
WrenchIcon,
} from "lucide-react";
import Link from "next/link";
import { usePathname } from "next/navigation";
import type { PropsWithChildren } from "react";
import Link from "~/components/Link";
import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "../ui/carousel";

export const Navigation = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/menu/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import * as z from "zod";
import { Form, FormControl, FormField, FormItem } from "~/components/ui/form";
import { Input } from "~/components/ui/input";

import Link from "next/link";
import { usePathname } from "next/navigation";
import Link from "~/components/Link";
import { Button } from "../ui/button";

export const SearchButton = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/menu/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BellIcon, BookmarkIcon, MailIcon } from "lucide-react";
import Link from "next/link";
import Link from "~/components/Link";
import { getLensClient } from "~/utils/getLensClient";
import { ServerSignedIn } from "../auth/ServerSignedIn";
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "../ui/accordion";
Expand Down
2 changes: 1 addition & 1 deletion src/components/notifications/NotificationView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Repeat2Icon,
UserPlusIcon,
} from "lucide-react";
import Link from "next/link";
import Link from "~/components/Link";
import { Card, CardContent } from "../ui/card";
import { UserAvatarArray } from "../user/UserAvatar";
import type { Notification } from "./Notification";
Expand Down
4 changes: 2 additions & 2 deletions src/components/post/PostInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Link from "next/link";
import Link from "~/components/Link";
import { TimeElapsedSince } from "../TimeLabel";
import { Button } from "../ui/button";
import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from "../ui/dropdown-menu";
Expand All @@ -11,7 +11,7 @@ export const PostInfo = ({ post }: { post: Post }) => {
const handle = author.handle;
const tags = post.metadata.tags || [];

let community = null
let community = null;
tags.map((tag) => {
if (tag.includes("orbcommunities")) {
community = tag.replace("orbcommunities", "");
Expand Down
6 changes: 3 additions & 3 deletions src/components/post/PostMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"use client";
import { EditIcon, ExternalLinkIcon, LinkIcon, MaximizeIcon, Share2Icon, ShareIcon, TrashIcon } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { toast } from "sonner";
import Link from "~/components/Link";
import { Button } from "../ui/button";
import type { Post } from "./Post";
import { useUser } from "../user/UserContext";
import type { Post } from "./Post";

export const PostMenu = ({ post}: { post: Post}) => {
export const PostMenu = ({ post }: { post: Post }) => {
const router = useRouter();
const author = post.author;
const { user } = useUser();
Expand Down
4 changes: 2 additions & 2 deletions src/components/post/PostReplyInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReplyIcon } from "lucide-react";
import Link from "~/components/Link";
import type { Post } from "./Post";
import Link from "next/link";

export const ReplyInfo = ({ post }: { post: Post }) => {
const username = post.reply?.author?.handle;
Expand All @@ -20,4 +20,4 @@ export const ReplyInfo = ({ post }: { post: Post }) => {
<span className="truncate pb-0.5 ">{content}</span>
</Link>
);
};
};
2 changes: 1 addition & 1 deletion src/components/user/UserAvatar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Avatar, AvatarFallback, AvatarImage } from "@/src/components/ui/avatar";
import Link from "next/link";
import Link from "~/components/Link";
import type { User } from "./User";
import { UserCard } from "./UserCard";

Expand Down
2 changes: 1 addition & 1 deletion src/components/user/UserCard.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";

import { type ProfileId, useLazyProfile } from "@lens-protocol/react-web";
import Link from "next/link";
import type { PropsWithChildren } from "react";
import Link from "~/components/Link";
import { FollowButton } from "../FollowButton";
import { LoadingSpinner } from "../LoadingIcon";
import { TruncatedText } from "../TruncatedText";
Expand Down
2 changes: 1 addition & 1 deletion src/components/user/UserLazyHandle.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";

import { useLazyProfile } from "@lens-protocol/react-web";
import Link from "next/link";
import { useState } from "react";
import Link from "~/components/Link";
import { LoadingSpinner } from "../LoadingIcon";
import { HoverCard, HoverCardContent, HoverCardTrigger } from "../ui/hover-card";
import { type User, lensProfileToUser } from "./User";
Expand Down
2 changes: 1 addition & 1 deletion src/components/user/UserProfile.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CalendarIcon, EditIcon, MessageCircleIcon, PawPrintIcon, User2Icon } from "lucide-react";
import Link from "next/link";
import { notFound } from "next/navigation";
import Link from "~/components/Link";
import { TimeSince } from "~/components/TimeLabel";
import { UserAvatar } from "~/components/user/UserAvatar";
import { getLensClient } from "~/utils/getLensClient";
Expand Down
4 changes: 2 additions & 2 deletions src/components/web3/LensProfileSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"use client";

import { profileId, useSession as useLensSession, useLogin, useProfilesManaged } from "@lens-protocol/react-web";
import { profileId, useLogin, useProfilesManaged, useSession as useLensSession } from "@lens-protocol/react-web";
import { setCookie } from "cookies-next";
import { PlusIcon } from "lucide-react";
import Link from "next/link";
import { toast } from "sonner";
import { useAccount as useWagmiAccount } from "wagmi";
import Link from "~/components/Link";
import { LoadingSpinner } from "../LoadingIcon";
import { Button } from "../ui/button";
import { Label } from "../ui/label";
Expand Down

0 comments on commit 429013b

Please sign in to comment.