#Apollo client & NextJS app router

3 messages · Page 1 of 1 (latest)

safe turtle
#

I'm experiencing issues with Apollo Client and the NextJS app router related to caching. Does anyone here have expertise with caching in this context?

The problem might be specific to NextJS, but I'm not entirely sure.

I have a query that fetches the contents of a cart. When users navigate to the /cart route, the data isn't cached (which is correct). However, if the page is refreshed, nested objects within the cart items are cached (not correct). I think this is a normalization cache of some sort, but cannot figure out how to disable it.

For instance, here's a sample of the data:
{
"name": "Product name", // not cached
"data": {
"color": "red" // cached
}
}It seems the cache is only hit upon a page refresh, not when navigating to the route. Any insights would be appreciated!

edgy pondBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

safe turtle
#

I got it fixed, but I dont know why. Wrapping the client component in Suspense corrected it. Even tho everything is Clientside and there is no promise in the child component