Accessing a field with arguments in cache.readFragment #1147
-
I'm trying to do something like the following inside an optimistic update: modifyCapabilities({ userId, groupId }, cache) {
const user = cache.readFragment(
gql`
fragment _ on UserQuery {
id
capabilities(byGroup: $groupId)
}
`,
{ id: userId, groupId, __typename: 'UserQuery' }
)
return {
// ... modified user object
}
} where Whenever I include the Is it not possible to query a field with variables like that in |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Have you tried passing the variable to the thirth argument, the second is meant to be a describing entity and the thirth one is used to signal variables https://github.com/FormidableLabs/urql/blob/main/exchanges/graphcache/src/store/store.ts#L191 |
Beta Was this translation helpful? Give feedback.
Have you tried passing the variable to the thirth argument, the second is meant to be a describing entity and the thirth one is used to signal variables https://github.com/FormidableLabs/urql/blob/main/exchanges/graphcache/src/store/store.ts#L191