Skip to content

Commit

Permalink
eager load first 15 images
Browse files Browse the repository at this point in the history
  • Loading branch information
RhysSullivan committed Oct 19, 2024
1 parent 29c3d0b commit b776ee1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/(category-sidebar)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default async function Home() {
},
orderBy: (collections, { asc }) => asc(collections.name),
});
let imageCount = 0;
return (
<div className="p-4">
{collections.map((collection) => (
Expand All @@ -23,7 +24,7 @@ export default async function Home() {
href={`/products/${category.slug}`}
>
<Image
loading="eager"
loading={imageCount++ < 15 ? "eager" : "lazy"}
src={category.image_url ?? "/placeholder.svg"}
alt={`A small picture of ${category.name}`}
className="mb-2 h-14 w-14 border hover:bg-yellow-200"
Expand Down

0 comments on commit b776ee1

Please sign in to comment.