Limit prefetching

This commit is contained in:
Sam Becker 2024-02-28 17:55:39 -06:00
parent 0c8dbdad1a
commit 2ffb899a5b
10 changed files with 21 additions and 3 deletions

View File

@ -13,6 +13,7 @@ export default function EditButton ({
title={label}
href={href}
className="button"
prefetch={false}
>
<FaRegEdit className="translate-y-[-0.5px]" />
<span className="hidden sm:inline-block">

View File

@ -24,7 +24,7 @@ export default function StorageUrls({
const addUploadPath = pathForAdminUploadUrl(url);
const uploadFileName = fileNameForStorageUrl(url);
return <Fragment key={url}>
<Link href={addUploadPath}>
<Link href={addUploadPath} prefetch={false}>
<ImageTiny
alt={`Upload: ${uploadFileName}`}
src={url}
@ -41,6 +41,7 @@ export default function StorageUrls({
title={uploadedAt
? `${url} @ ${formatDate(uploadedAt, 'yyyy-MM-dd HH:mm:ss')}`
: url}
prefetch={false}
>
{uploadFileName}
</Link>

View File

@ -79,6 +79,7 @@ export default async function AdminPhotosPage({
key={photo.id}
href={pathForPhoto(photo)}
className="lg:w-[50%] flex items-center gap-2"
prefetch={false}
>
<span className={clsx(
'inline-flex items-center gap-2',

View File

@ -26,8 +26,8 @@ export default async function AdminTagsPage() {
<Fragment key={tag}>
<div className="pr-2 -translate-y-0.5">
{isTagFavs(tag)
? <FavsTag />
: <PhotoTag {...{ tag }} />}
? <FavsTag prefetch={false} />
: <PhotoTag {...{ tag, prefetch: false }} />}
</div>
<div className="text-dim uppercase">
{photoQuantityText(count, false)}

View File

@ -11,6 +11,7 @@ export default function PhotoCamera({
type = 'icon-first',
badged,
contrast,
prefetch,
countOnHover,
}: {
camera: Camera
@ -43,6 +44,7 @@ export default function PhotoCamera({
type={showAppleIcon && isCameraApple ? 'icon-first' : type}
badged={badged}
contrast={contrast}
prefetch={prefetch}
hoverEntity={countOnHover}
/>
);

View File

@ -7,6 +7,7 @@ export interface EntityLinkExternalProps {
type?: 'icon-last' | 'icon-first' | 'icon-only' | 'text-only'
badged?: boolean
contrast?: 'low' | 'medium' | 'high'
prefetch?: boolean
}
export default function EntityLink({
@ -18,6 +19,7 @@ export default function EntityLink({
type = 'icon-first',
badged,
contrast,
prefetch,
hoverEntity,
}: {
label: ReactNode
@ -46,6 +48,7 @@ export default function EntityLink({
!badged && 'text-main hover:text-gray-900 dark:hover:text-gray-100',
contrast === 'low' && 'text-dim',
)}
prefetch={prefetch}
>
{type !== 'icon-only' && <>
{badged

View File

@ -36,6 +36,7 @@ export default function PhotoGridSidebar({
key={TAG_FAVS}
countOnHover={count}
type="icon-last"
prefetch={false}
badged
/>
: <PhotoTag
@ -43,6 +44,7 @@ export default function PhotoGridSidebar({
tag={tag}
type="text-only"
countOnHover={count}
prefetch={false}
badged
/>)}
/>}
@ -60,6 +62,7 @@ export default function PhotoGridSidebar({
camera={camera}
type="text-only"
countOnHover={count}
prefetch={false}
hideAppleIcon
badged
/>)}
@ -80,6 +83,7 @@ export default function PhotoGridSidebar({
simulation={simulation}
countOnHover={count}
type="text-only"
prefetch={false}
/>
</div>)}
/>}

View File

@ -9,6 +9,7 @@ export default function PhotoFilmSimulation({
type = 'icon-last',
badged = true,
contrast = 'low',
prefetch,
countOnHover,
}: {
simulation: FilmSimulation
@ -29,6 +30,7 @@ export default function PhotoFilmSimulation({
type={type}
badged={badged}
contrast={contrast}
prefetch={prefetch}
hoverEntity={countOnHover}
/>
);

View File

@ -8,6 +8,7 @@ export default function FavsTag({
type,
badged,
contrast,
prefetch,
countOnHover,
}: {
countOnHover?: number
@ -37,6 +38,7 @@ export default function FavsTag({
hoverEntity={countOnHover}
badged={badged}
contrast={contrast}
prefetch={prefetch}
/>
);
}

View File

@ -8,6 +8,7 @@ export default function PhotoTag({
type,
badged,
contrast,
prefetch,
countOnHover,
}: {
tag: string
@ -24,6 +25,7 @@ export default function PhotoTag({
type={type}
badged={badged}
contrast={contrast}
prefetch={prefetch}
hoverEntity={countOnHover}
/>
);