You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a query omits arguments from a field that field is cached as fieldName whereas when a query defined those arguments as optional but then they are not passed in as variables it is cached as fieldName({}) despite both of those cases being identical from the point of view of the GraphQL server. This is surprising and causes an issue where a query with the ability to set field arguments can never read from a cache set by a query that does not have those arguments, no matter what variables are set.
Click on "Switch" and watch the components switch from a query without args to one with args but where they're not set in the variables. These two queries should share a single cached value but they do not, two different values are stored.
@apollo/client version
3.11.4
The text was updated successfully, but these errors were encountered:
Thank you for bringing this up - I've opened #12370 to address this. Could you please try out the PR build from that issue and report back if it behaves as expected for you now?
Issue Description
When a query omits arguments from a field that field is cached as
fieldName
whereas when a query defined those arguments as optional but then they are not passed in as variables it is cached asfieldName({})
despite both of those cases being identical from the point of view of the GraphQL server. This is surprising and causes an issue where a query with the ability to set field arguments can never read from a cache set by a query that does not have those arguments, no matter what variables are set.Link to Reproduction
https://codesandbox.io/p/devbox/damp-star-6vkn89?workspaceId=ws_NweYYNTBLCG39JiWfDJEb
Reproduction Steps
Click on "Switch" and watch the components switch from a query without args to one with args but where they're not set in the variables. These two queries should share a single cached value but they do not, two different values are stored.
@apollo/client
version3.11.4
The text was updated successfully, but these errors were encountered: