Skip to content

Commit

Permalink
revert image prefetching
Browse files Browse the repository at this point in the history
  • Loading branch information
cdleveille committed May 31, 2024
1 parent 1c98b06 commit ea272b9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ export default async function RootLayout({
modal: React.ReactNode;
}>) {
const discs = await API.getDiscs();
const imageUrls = discs.map(({ pic }) => pic).filter(pic => !!pic);
await API.fetchMany(imageUrls);
return (
<html lang="en">
<body className={inter.className}>
<DiscContextProvider discs={discs}>
{modal}
{children}
{modal}
</DiscContextProvider>
</body>
</html>
Expand Down
3 changes: 1 addition & 2 deletions src/components/DiscDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ export const DiscDetail = ({ name_slug }: DiscDetailProps) => {
</div>
</div>
<div className="disc-detail-img-container">
{/* eslint-disable-next-line @next/next/no-img-element */}
<img src={pic} alt={name} className="disc-detail-img" />
<Image src={pic} alt={name} width={400} height={340} className="disc-detail-img" />
</div>
</div>
</Modal>
Expand Down
3 changes: 1 addition & 2 deletions src/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ export const API = {
url: `${config.API_URL}/disc`,
method: RequestMethod.GET,
tags: ["disc"]
}),
fetchMany: async (urls: string[]) => Promise.allSettled(urls.map(url => fetch(url, { next: { tags: ["image"] } })))
})
};

0 comments on commit ea272b9

Please sign in to comment.