docs: Fix an error in the mutations documentation (#390)
This commit is contained in:
committed by
Guillaume Chau
parent
15bb0f732e
commit
94e434f44b
@@ -33,11 +33,11 @@ methods: {
|
||||
// Update the cache with the result
|
||||
// The query will be updated with the optimistic response
|
||||
// and then with the real result of the mutation
|
||||
update: (store, { data: { newTag } }) => {
|
||||
update: (store, { data: { addTag } }) => {
|
||||
// Read the data from our cache for this query.
|
||||
const data = store.readQuery({ query: TAGS_QUERY })
|
||||
// Add our tag from the mutation to the end
|
||||
data.tags.push(newTag)
|
||||
data.tags.push(addTag)
|
||||
// Write our data back to the cache.
|
||||
store.writeQuery({ query: TAGS_QUERY, data })
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user