Closed alex-e-leon closed 3 weeks ago
Hey @alex-e-leon!
You beat me to opening this 😆. I discovered this just recently working with the data masking feature. We did some rework with useFragment
to ensure it follows the Rules of React (specifically not writing to ref
in render), but I just found out that causes this warning. I know exactly where the issue is coming from so I'll get a PR out for this very soon (hopefully today). So sorry about the additional noise!
This is the punishment I get for staying up to date with all the latest deps : )
And thanks @jerelmiller - its great to get such fast feedback and see that you're already on top of it!
Not on you 😆. We unfortunately had a missing test so we didn't see the regression on our end.
I just opened https://github.com/apollographql/apollo-client/pull/12052 which should fix the issue. Could you try this snapshot release to see if the warning goes away?
npm i @apollo/client@0.0.0-pr-12052-20240903200316
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.
@jerelmiller - sorry, I've been super busy this week, so probably don't have time to test the branch right now. But looks like you guys are on top of it. Thanks for the quick response and looking forward to seeing it in the next release!
You're welcome! I just got it released so you can to upgrade to 3.11.7 and the warning should disappear. Thanks again for reporting the issue!
Issue Description
Since @apollo/client 3.11.5 I've started receiving warnings in the console during store misses of useFragment in development:
TypeError: Cannot read properties of undefined (reading '__typename')
A bit of testing suggests that this happens in all my uses of useFragment during store misses. Note that although I get the warning, everything continues to work fine. @apollo/client 3.11.4 did not have this issue.
In case it's relevant I'm using the following arguments on useFragment:
fragment, fragmentName, from: {__typename: X, id: X}
The full stack trace is:
Link to Reproduction
None
Reproduction Steps
Call useFragment on any fragment which hasn't been loaded into the FE cache/store by typename + id.
@apollo/client
version3.11.5