Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs(graphcache): Add example to "Variables for Optimistic Updates" (#3077)

authored by

Romain Trotard and committed by
GitHub
3e0f34a9 47c34c41

+13 -1
+13 -1
docs/graphcache/cache-updates.md
··· 544 544 545 545 However, we're able to pass additional variables to our mutation, e.g. `{ extra }`, and since 546 546 `$extra` isn't defined it will be filtered once the mutation is sent to the API. An optimistic 547 - mutation however will still be able to access this variable. 547 + mutation however will still be able to access this variable, like so: 548 + 549 + ```js 550 + cacheExchange({ 551 + updates: { 552 + Mutation: { 553 + updateTodo(_result, _args, _cache, info) { 554 + const extraVariable = info.variables.extra; 555 + }, 556 + }, 557 + }, 558 + }); 559 + ``` 548 560 549 561 ### Reading on 550 562