Skip to content

Commit

Permalink
Add prefetch attribute "viewport" on internal links
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasKn committed Dec 3, 2023
1 parent eb58057 commit 6f25047
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion templates/hydrogen-theme/app/components/CollectionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function CollectionCard(props: {

return (
<div className="overflow-hidden rounded-lg border">
<Link to={`/collections/${collection.handle}`}>
<Link prefetch="viewport" to={`/collections/${collection.handle}`}>
{collection.image && (
<Image aspectRatio="16/9" sizes="33vw" data={collection.image} />
)}
Expand Down
2 changes: 1 addition & 1 deletion templates/hydrogen-theme/app/components/ProductCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function ProductCard(props: {

return (
<div className="overflow-hidden rounded-lg border">
<Link to={`/products/${product.handle}`}>
<Link prefetch="viewport" to={`/products/${product.handle}`}>
{firstVariant.image && (
<Image aspectRatio="16/9" sizes="33vw" data={firstVariant.image} />
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function SanityInternalLink(props: {

// Todo: add Navlink support
return (
<Link prefetch="intent" to={url} className={className}>
<Link prefetch="viewport" to={url} className={className}>
{children ? children : name}
</Link>
);
Expand Down

0 comments on commit 6f25047

Please sign in to comment.