Skip to content

How do you pass additional args to the optimistic update functions? #2106

Answered by kitten
taylorcantwell asked this question in Q&A

You must be logged in to vote

I think the docs aren't precise enough here and I'll have to fix them up. Apologies! 🙏

Basically, variables and arguments are different here. You define your variables, e.g. $var and your field args, e.g. input: $var. Your field will only see input: ... since it takes a subset of the variables. GraphQL basically allows Graphcache to also filter variables before they're sent to the API.

That means that during optimistic mutations however, were able to send more variables because they haven't been filtered for the API yet. Hence you'll see more variables that you've passed, but not more arguments. The variables will still be filtered later however

To then access the raw variables, you can use

Replies: 1 comment 1 reply

You must be logged in to vote
1 reply
@taylorcantwell

Answer selected by taylorcantwell
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