Describe the bug#
I have a problem when I want to updating the cache in my Nextjs project
First I Prefetch Queryand used the hydration boundary like in the docs/client/app/product/[productId]/page.tsx`
Secondly and where the problem comes when I try to set the cache it makes the cache I want undefined /client/components/SingleProduct.tsx

Your minimal, reproducible example#
https://codesandbox.io/p/github/TheMostafaOsamaDev/shoop-e-commerce/main?file=%2Fclient%2Fapp%2Fproduct%2F%5BproductId%5D%2Fpage.tsx&import=true
Steps to reproduce#
We two directories client and server
- Go to each one and install dependencies
npm i
- Start the NestJS server
npm run start:dev
- Start the client with
npm run dev
- In the route page
/ Go to single product page (Click on the card) and try to add it to wishlist.
Expected behavior#
I expect when I update the cache to change the isInWishList to true or false when onMutate
How often does this bug happen?#
None
Screenshots or Videos#
https://github.com/user-attachments/assets/8ef89b28-28d4-4796-a762-21773f7787e8
Platform#
- Windows 10
- Chrome
- When updating the cache
Tanstack Query adapter#
None
TanStack Query version#
5.56.2
TypeScript version#
5
Additional context#
Nextjs 14
This isn’t a minimal reproduction, this is just your full-blown project. Please trim it down to a minimal reproduction, otherwise, there are too many factors that could be in play here. I will happily re-open and look into the issue once that’s done.