Skip to content
Discussion options

You must be logged in to vote

cache.readFragment’s second argument here needs to be a key or a keyable entity, so { __typename: "SampledGrade", visitId: "..." } if that's your full type or cache.keyOfEntity({ __typename: "SampledGrade", visitId: "..." }).

As you can see here by keyOfEntity is what you may be confused about. A key is not an ID, because we still preserve the type in our key. Essentially that's opinionated but unlike Relay we assert that no two types can share the same entity as they're different, so all keys contain the type name.

Given that and the method the readFragment method only accepts a full key or a partial entity from which a key can be generated.

By the way, given this there's a shorter way …

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by kitten
Comment options

You must be logged in to vote
1 reply
@kitten
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants