ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

ion-infinite-scroll on-infinite called multi times version 1.0.0.beta6

Open Set2005 opened this issue 12 years ago • 8 comments

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>

Set2005 avatar Jun 05 '14 04:06 Set2005

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.

perrygovier avatar Jun 05 '14 13:06 perrygovier

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

Set2005 avatar Jun 05 '14 21:06 Set2005

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.

Set2005 avatar Jun 08 '14 23:06 Set2005

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.

perrygovier avatar Jun 20 '14 20:06 perrygovier

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

guillaume86 avatar Oct 31 '14 12:10 guillaume86

Having the same issue.

anonrig avatar Feb 04 '16 09:02 anonrig

Same issue here, with already loaded values (so there is no response time before more values are loaded)... Anyone found something?

HugoHeneault avatar Apr 22 '17 10:04 HugoHeneault

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.

ionitron-bot[bot] avatar Sep 03 '18 07:09 ionitron-bot[bot]