ion-infinite-scroll does not fire the ionInfinite event if my initial retrieval of records does not fill the page.
I retrieve a batch of 10 records at a time and if I’m running the app in a full-screen browser this initial batch of records only fills about half of the infinite scroll area. I was expecting ionInfinite to be called to retrieve a second batch of records to fill the area (or be told that there are no more records).
If I shrink the window so that the area shows scrollbars then ionInfinite is called when the user scrolls down.
The user should not have to resize the window to get a full page of records.
There is an open issue for this from Ionic v3 Issue #59.
No solution, only workarounds that dig into the internals of the control which I’m loath to do given we are now at Ionic v5.
I can increase the number of records I retrieve per page to fill all form factors, but I’m using Firebase and this would be an increase in costs to work around a bug in Ionic.
I did have the same issue and created the following work-around.
It seems to work correctly, but I still have the feeling that I am missing something obvious. I think this should be working out of the box.
Technically it’s just this: <IonInfiniteScroll threshold="0">
In the end I found that this didn’t work, though. At least not reliably. What I settled on was a component that can force the scroll until results appear.
Here’s the Vue component I made to accomplish that, it’s not intelligible on its own because it imports some utility functions but it might have some insight in it.
I know this is old, but I encountered the same issue and found this thread. I couldn’t get ion-infinite-scroll to work properly either so I dumped it completely and built my own logic using IntersectionObserver