I think that with position = top no infinite scroll event should be triggered with a down scrolling. Seems that it triggers an event when there is a movement in the trigger zone without differentiating the direction.
What is also not quite optimal is that there is a position in the trigger zone (PWA on desktop) where infinite scroll events are triggered until “event.target.disabled = true” is called. That’s why I have to limit the number of items and call “event.target.disabled = true” so that not all data records are loaded automatically into the array.
Is there anything in the code that I can do better?
Once disabled it is not possible to enable ion-infinite-scroll again? I tried to enable it with a boolean variable (infinite_scroll_disabled=false) when reentering the view with data from the beginning, but it stays disabled.
So I have to keep it enabled even when there is no more data. But sometimes you get infinite “infinite scroll events” if you hit a certain position in the trigger zone! Each infinite scroll event tries to request data from my server.
ion-infinite-scroll urgently needs to be improved.
Glad you figured out a workaround! I am not sure what is going on in your case, but I know I tried infinite scroll with a position of top earlier this year and there were some weird issues with it. I ended up creating my own logic using IntersectionObserver.
I just updated to Ionic 7 from Ionic 6 and i started having this same issue, can’t re-enable the infinite scroll by setting
.disabled = false;
This broke my app as once it reached the end of my products list, it wont ever work again. I got some filters that the user can apply do the list and when the list updates I only get the fist batch of products and the infinite scroll never works again.