vue-infinite-loading
vue-infinite-loading copied to clipboard
On page load infinite-loading runs twice duplicateing content
Version
2.4.4
Vue.js version
2.6.8
###Reproduction link https://jsfiddle.net/nephilius/v7zp9hd8/1/ (there is diferent link to WP REST API but error is reproduced)
Steps to reproduce
Visible under this link: http://tumblr.hekko24.pl/
Component: <infinite-loading @infinite="infiniteHandler" spinner="bubbles" force-use-infinite-wrapper="false">
Heandler method: infiniteHandler ($state) { var postsUrl = 'tumblr.hekko24.pl/wp-json/wp/v2/posts/?_embed&number='+this.perPage+'&page='+this.currentPage
axios.get(postsUrl, {params: this.postsData})
.then(response => {
let posts = response.data
if (posts.length) {
this.posts = this.posts.concat(posts)
$state.loaded()
} else {
$state.complete()
}
++this.currentPage
})
.catch(e => {
this.errors.push(e)
})
},
What is Expected?
On page load call once, on scroll load more content.
What is actually happening?
On page load is called twice duplicating content, later on scroll loads same content again and again.
Any Solution for Duplicate ?