apollo
apollo copied to clipboard
fetchMore duplicating new results instead of merging with previousResult
Version 3.0.0-beta.25 I'm trying to fetchMore results from server, howerver, the new records are duplicated.
I have a list: A,B,C I'm using fetchMore to load D,E,F. The server response is ok, but vue-apollo gives me D,E,F,D,E,F
Here's the techMore method:
`show_more_comments(){
if(this.fetched){
this.$set( this,'page', this.page + 1 )
this.$apollo.queries.comments.fetchMore({
variables:{
page:this.page,
limit:this.limit,
post_id:this.post.id
},
updateQuery: (previousResult, {fetchMoreResult}) => {
const newComments = fetchMoreResult.comments.data
return {
comments: {
__typename: previousResult.comments.__typename,
data: [...previousResult.comments.data, ...newComments]
}
}
}
})
} else {
this.triggerCommentsQuery()
}
}`
~~I'm getting this too, even when just copy-pasting the documentation.~~
query.fetchMore({
variables,
updateQuery: (
previous: ListViewQuery,
{ fetchMoreResult: result },
): ListViewQuery => {
return {
ListEntries: [...previous.ListEntries, ...result.ListEntries],
}
},
})
Nevermind, it was fetching the wrong pages in fetchMore
@EdnaldoNeimeg Could you please provide a runnable reproduction? Thanks!