Hi,
I'm using vue-apollo for the component's data. It works fine and calls the query when the component will be created. But I need to query the data again after mutations. How can I achieve this?
That's the essential part of the component:
export default {
data() {
return {
players: []
}
},
apollo: {
players: queries.Players
},
methods: {
async deletePlayer(userToDelete) {
await (this.$apollo.mutate({
mutation: mutations.DeletePlayer,
variables: {
id: userToDelete.id
}
}))
// TODO: call query again
}
}
}
hey, use update for mutation to update cache: http://dev.apollodata.com/react/cache-updates.html#directAccess , or refetching all by this.$apollo.queries.QUERY_NAME.refetch(). But best solution is update cache
Thanks for the fast answer.
Most helpful comment
hey, use update for mutation to update cache: http://dev.apollodata.com/react/cache-updates.html#directAccess , or refetching all by
this.$apollo.queries.QUERY_NAME.refetch(). But best solution is update cache