ion-infinite-scroll on-infinite called multi times version 1.0.0.beta6
why my ng-infinite called multiple times when scroll to the bottom?
<div id="masonry" style="margin:0 auto;padding:0;" preserve-order>
<div class="masonry-brick half pin" ng-repeat="deal in deals" >
</div>
<ion-infinite-scroll ng-if="!noMoreItemsAvailable" on-infinite="infiniteLoad()" distance="10%"></ion-infinite-scroll>
Hey @jianbo, I'd have to see the larger context, could you put together a codepen example? Note, that if you're wondering how to use infinite scroll with a 3rd party plugin like masonry, that might be a discussion better had in the forums.
Hi,
I don't think its about the masonry, I tested with a list still having the problem, http://forum.ionicframework.com/t/on-infinite-called-twice-when-using-ion-infinite-scroll/5216/2
<div class="list">
<div class="deal" ng-repeat="deal in deals">
<img id="uplaoded-image" style="width:50%;" ng-src="{{deal.image.original.mobile_large.url}}" />
</div>
</div>
<ion-infinite-scroll ng-if="!noMoreItemsAvailable" on-infinite="loadDeal()" distance="5%"></ion-infinite-scroll>
http://codepen.io/mhartington/pen/KzGaw
after infiniteScrollCtrl.isLoading set to true line 40200, the infiniteScrollCtrl.isLoading(line 40226 checkInfiniteBounds()) still returns false, so onInfinite() runs again. Any idea? Setting a break point at line 40200 then resume will make it work properly.
Hey @jianbo, looking at @ajoslin's example in a related ticket, It appears this is a false positive. In some cases, I can get infinite scroll to fire twice, but only when the response is so fast that scroll events are still happening, and firing more requests before the bounce-back effect finishes. If this is the case, you're likely returning too few results per chunk.
Let me know if you still see this in @ajoslin's example, but I think this mystery is solved.
So there's a bug induced by a race condition in the code? I get two "loadMore()" calls on initial loading (so first page + 2 not requested pages) and if I scroll down, I get 4 "loadMore()" when reaching bottom.
Should I open a separate bug or you can reopen this?
Thanks in advance
Having the same issue.
Same issue here, with already loaded values (so there is no response time before more values are loaded)... Anyone found something?
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.