Next.js Discord

Discord Forum

Caching not working when I switch browser tabs

Unanswered
Thrianta posted this in #help-forum
Open in Discord
ThriantaOP
Okay so this is kind of a weird problem. Not gonna lie.

I'm using the <Image/> tag to bring in some images from an api. I'm using map to list all of them inside a grid. And then I have three separate tabs inside the page with separate images. On the first load, it works perfectly. I switch the tabs and all the images are served from the cache. No loading is required.

Now comes the crazy part, when I switch to another browser tab (example: twitter or youtube) and I come back to my deployment tab, the caching is gone entirely. Now the images and my page.tsx load every single time I switch between the inner tabs.

Sorry I can't share the code and the api here due to NDA reasons, but has anyone else encountered this issue?

Some details:
Machine: Apple M1 max (tested it on regualr M1 machines as well)
Browser: Chrome (tested on Safari as well)
Deployment: Via vercel
Next.js: 14.0.2

Please let me know if any other details are required and I'll be happy to share.

0 Replies