Hi, new to apollo and really struggling to understand some of the things I am seeing.
I have this query:
query {
getUserCollectionListing {
edges {
node {
id
owner
name
items {
... on object_Metadata {
id
__typename
}
}
__typename
}
}
}
}
Which is used like so:
const { loading, error, data, refetch } = useQuery(GET_USER_BASKETS, {
fetchPolicy: 'network-only'
});
I am trying to access the cache for this query using ‘readFragment’:
cache.readFragment({
id: currentBasket, // looks like: object_UserCollection:822134
fragment: gql`
fragment Object_UserCollectionFragment on Object_UserCollection {
id
name
owner
items
__typename
}
`,
// fragmentName: 'Object_UserCollectionFragment', // tried with and without
});
But the problem is the object returned by ‘readFragment’ is not complete, and only contains the ‘__typename’:
I feel like I have circled the documentation and examples endlessly and I don’t understand why this would be the case. What would cause the rest of that entry to be missing?
‘cache.readQuery’ on 'GET_USER_BASKETS` appears to returned the cached data, so I can get it from there if needed, but I would really like to understand the behavior I’m seeing.
Thanks in advance.