Skip to content

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

Closed

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.

Activity

  1. positlabs commented on Jul 1, 2019

    @positlabs

    Can't you emit that event yourself?

  2. RafaelKr commented on Jul 1, 2019

    @RafaelKr
    Author

    I could always call my fetchMore function on ionViewDidEnter, but that's not what I want. I only want to do that if the list is scrolled into the threshold area.

  3. liamdebeasi commented on Dec 14, 2023

    @liamdebeasi
    Contributor

    Hey there,

    The problem you were running into was the same as #18071. I was able to fix this issue in #28569, so scrolling after going back should trigger the infinite scroll event even if you are still scrolled within the threshold. Since the root issue is fixed, I am going to close this. This fix is available in Ionic 7.6.0+. Let me know if you have any questions.

  4. ionitron-bot commented on Jan 13, 2024

    @ionitron-bot

    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.

  5. locked and limited conversation to collaborators on Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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