Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<template>
<!-- ...html -->
</template>
<script>
// ... code
import { OPTION_VOTED, POLL_CREATED } from '@/gql/subscriptions/poll.subscriptions'
// ... code
export default {
// ... code
apollo: {
polls: {
query: POLLS,
subscribeToMore: [
{
document: OPTION_VOTED,
},
{
document: POLL_CREATED,
updateQuery(previousResult, { subscriptionData }) {
return {
polls: [
subscriptionData.data.pollCreated,
...previousResult.polls,
]
}
}
}
]
}
},
// ... code
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.