Skip to content

feat: IonInfiniteScroll should expose a method to trigger threshold check #18653

Description

@RafaelKr

Feature Request

Ionic version:

[x] 4.x

Describe the Feature Request

I have a routing setup which is similiar to this:

/items/subscribed
/items/all
/items/details/:id

/items/subscribed contains a list of items which are subscribed by the user.
/items/all contains a list of all items (subscribed and not subscribed). It can be seen as a childpage of /items/subscribed, because it is routerLinked with push direction from there.
/items/details/:id is the detail page where the subscription state of an item can be toggled.
The lists both have an ion-infinite-scroll at the end. It loads batches of 30 items.

My Problem:
I'm on the /items/subscribed page and scroll down, so the infinite scroll is triggered and I have 60 items. I scroll more, so I can't see any item of the first 30 ones. Now I navigate to the /items/all page and subscribe to a new item. When I do this, I refetch the list of subscribed items, but only the first 30. When I now navigate back to /items/subscribed, the list only contains this 30 items, so the list is fully scrolled to the end, but the ionInfinite-Event doesn't trigger now. I have to scroll up above the threshold and then scroll down again to trigger it.

Describe Preferred Solution

I would like to call something like this.ionInfiniteScroll.triggerCheck() in my ionViewDidEnter hook, which checks if the ionInfinite-Event should trigger.

Describe Alternatives

An alternative would be to check this automatically. But I think that's not really possible or is bad for performance reasons.

Additional Information
I also noticed, that the ionInfinite-Event sometimes doesn't trigger when I'm scrolling really really fast and reaching the end while another ionInfinite-Event is in progress. Maybe the check should also be triggered again, when the complete callback is called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions