mirror of
https://github.com/Hackdex-App/hackdex-website.git
synced 2026-08-22 00:24:34 -05:00
Disable prefetching by default on HackCards and otherHacks
This commit is contained in:
@@ -558,6 +558,7 @@ export default async function HackDetail({ params }: HackDetailProps) {
|
||||
<li key={otherHack.slug}>
|
||||
<Link
|
||||
href={`/hack/${otherHack.slug}`}
|
||||
prefetch={false}
|
||||
target="_blank"
|
||||
className="group block hover:text-foreground"
|
||||
>
|
||||
|
||||
@@ -247,7 +247,7 @@ export default async function Home() {
|
||||
</div>
|
||||
<div className="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{hackData.map((hack) => (
|
||||
<HackCard key={hack.slug} hack={hack} />
|
||||
<HackCard key={hack.slug} hack={hack} prefetch={true} />
|
||||
))}
|
||||
</div>
|
||||
<div className="sm:hidden flex justify-center mt-6">
|
||||
|
||||
@@ -13,6 +13,7 @@ import { FaRegImages } from "react-icons/fa6";
|
||||
import { ImDownload } from "react-icons/im";
|
||||
import { RiArchiveStackFill } from "react-icons/ri";
|
||||
import type { Database } from "@/types/db";
|
||||
import type { LinkProps } from "next/link";
|
||||
|
||||
export interface HackCardAttributes {
|
||||
slug: string;
|
||||
@@ -29,7 +30,19 @@ export interface HackCardAttributes {
|
||||
completion_status?: Database["public"]["Enums"]["Completion Status"] | null;
|
||||
};
|
||||
|
||||
export default function HackCard({ hack, clickable = true, className = "" }: { hack: HackCardAttributes; clickable?: boolean; className?: string }) {
|
||||
interface HackCardProps {
|
||||
hack: HackCardAttributes;
|
||||
clickable?: boolean;
|
||||
prefetch?: LinkProps["prefetch"];
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export default function HackCard({
|
||||
hack,
|
||||
clickable = true,
|
||||
prefetch = false,
|
||||
className = "",
|
||||
}: HackCardProps) {
|
||||
const isArchive = hack.is_archive;
|
||||
const { isLinked, hasPermission, hasCached } = useBaseRoms();
|
||||
const match = baseRoms.find((r) => r.id === hack.baseRomId);
|
||||
@@ -222,6 +235,7 @@ export default function HackCard({ hack, clickable = true, className = "" }: { h
|
||||
href={`/hack/${hack.slug}`}
|
||||
className={`group block ${className}`.trim()}
|
||||
draggable={false}
|
||||
prefetch={prefetch}
|
||||
onDragStart={(e) => {
|
||||
e.preventDefault();
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user