[Next.js Image Component] Cache Images between pages

I'm using Tanstack Query to dynamically fetch data that includes an image URL, which I then load using the <Image /> component. On a different page, I fetch new data, but the image URL is often the same as the one on the previous page. The issue is that the same image gets loaded twice. Is there a way to reuse the image across both pages to avoid reloading it?
4 Replies
none23
none23•2mo ago
I think, cache-policy should already take care of that in a production build, unless you are using optimize={false} or have Disable cache checked in dev tools That is is the image url is the same
FleetAdmiralJakob 🗕 🗗 🗙
wait, the disable cache is only acitve when the devtools (network tab) are open right?
none23
none23•2mo ago
Not sure about the default, check the Network tab
No description
FleetAdmiralJakob 🗕 🗗 🗙
yeah, ok, i will try it out in a prod build
Want results from more Discord servers?
Add your server