apollo
apollo copied to clipboard
Refetch causes _this2.options.variables.call is not a function
Describe the bug When trying to get next posts from WPGraphql, then refetch fails
methods: {
showMore() {
this.offset += this.size
this.$apollo.queries.posts.refetch({
size: 6,
offset: 6,
})
},
},
Initial graphQL post request is working, its like this:
apollo: {
posts: {
query: gql`
query Posts($size: Int, $offset: Int) {
posts(where: { offsetPagination: { size: $size, offset: $offset } }) {
pageInfo {
offsetPagination {
hasMore
hasPrevious
total
}
}
nodes {
id
title
excerpt
uri
featuredImage {
node {
srcSet
}
}
categories {
nodes {
name
}
}
}
}
}
`,
variables() {
return {
size: this.size,
offset: this.offset,
}
},
},
},
}
I\m also having everything in data described and initial loading is okay but getting next posts is not working
data() {
return {
size: 6,
offset: 0,
showMoreEnabled: true,
}
},
Expected behavior To change my state with new posts. Pagination is needed, fetchMore is out of question because it shows too much posts finally.
Versions nuxt: 2.14.12 @nuxtjs/apollo: 4.0.1-rc5