-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useFragment
, returns false data.
#11688
Comments
useFragment
, returns false data.
Hey @panchaldeep009 👋 I have a good idea on what might be happening here. Just to confirm, are you seeing another render after props change with the correct data? My guess is you're seeing this timeline:
When you should be seeing this timeline:
I think we might have a gap in our tests unfortunately that didn't catch this earlier. Thanks for reporting! |
Yes, I was able to see the correct data on the next render cycle. |
Awesome thank you! I'll try and get to this as soon as I can. |
I've got a PR open to fix this: #11689. I would expect this to go out sometime next week. Thanks again for raising the issue! |
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Issue Description
There is a re-render instance where the
useFragment
returns the wrong data for the requested cache id.Screen.Recording.2024-03-15.at.1.20.37.PM.mov
It is only for 1 or 2 render cycles, eventually, it re-renders and returns correct data. but the expected behavior should never return the wrong data for a cache ID.
Link to Reproduction
https://stackblitz.com/edit/vitejs-vite-po6ehx?file=src%2FApp.tsx
Reproduction Steps
useFragment
returns User 1 data for User 2 cache ID therefore based on code setup it will throw an exception thatUser id does not match Expected: 2, Actual: 1
@apollo/client
version3.9.7
The text was updated successfully, but these errors were encountered: