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

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

Changed files
+13 -1
docs
graphcache
+13 -1
docs/graphcache/cache-updates.md
···
However, we're able to pass additional variables to our mutation, e.g. `{ extra }`, and since
`$extra` isn't defined it will be filtered once the mutation is sent to the API. An optimistic
-
mutation however will still be able to access this variable.
+
mutation however will still be able to access this variable, like so:
+
+
```js
+
cacheExchange({
+
updates: {
+
Mutation: {
+
updateTodo(_result, _args, _cache, info) {
+
const extraVariable = info.variables.extra;
+
},
+
},
+
},
+
});
+
```
### Reading on