Skip to content

Paging helper for Firestore queries #550

Closed

Description

@IchordeDionysos

Hi,

Just thought how one could easily integrate some paging for a long list like an activity which should ideally not loaded all at once rather incrementally if the user needs to.

And my thought was: Well we could build something ourselves, but then I thought this is a rather repetitive task so I think it would be great to get this behavior in something like FirebaseUI.

The idea is we developer just give a query to Firebase UI and then all the heavy lifting get's take care of,

  • like checking if how many contents should be loaded initially (maybe there could be an option to help Firebase UI to determine how many should be loaded),
  • when new content should be loaded due to the scrolling position,
  • sending out delegate methods when to display a loader or better having a delegate method which returns a UIView which then gets displayed at the right end of the Table/CollectionView as a loader
  • keeping track of changes to documents and what content to load next
  • updating the local copy of array when new content gets loaded and so on.

What are your thought on this?

Activity

  1. morganchen12 commented on Oct 22, 2018

    @morganchen12
    Contributor

    We're making some improvements to FUIArray in this area. This is something we could build into a data source, but for the time being it's something you'll have to build on your own. You can do this by:

    • Make a query with some base limit (say, 50 elements), and using an FUIArray instance to load the query.
    • Track the user's scroll position.
    • When the user is almost at the end of the list, change the query on the FUIArray to the same query with a different limit (say, 100 elements).
    • The FUIArray will automatically download the new query's contents and diff them for you.

    Currently this doesn't scale beyond a hundred or so elements, but we're adding improved support for that in #548.

  2. self-assigned this
    on Oct 22, 2018
  3. willbattel commented on Jan 4, 2019

    @willbattel
    Contributor

    Any update on this? We need paging support and changing the query limit isn't feasible because, as you mentioned, the query begins getting very large very quickly. There needs to be a way to incorporate the query cursors so that we only have to load the additional elements, not the entire query every time: i.e., instead of first loading 0-49, then 0-99, then 0-149, the proper paging implementation should first load 0-49, then 50-99, then 100-149, etc.. as the user continues scrolling. There should be a method we can call from the UITableViewDataSourcePrefetching delegate method prefetchRowsAt to let FirebaseUI fetch the data ahead of time.

  4. IchordeDionysos commented on Mar 3, 2020

    @IchordeDionysos
    Author

    @morganchen12 Are there any updates on this?

  5. morganchen12 commented on Mar 3, 2020

    @morganchen12
    Contributor

    No, unfortunately I haven't started work on this yet.

  6. willbattel commented on Jul 11, 2021

    @willbattel
    Contributor

    Hey @morganchen12 just wanted to indicate that we'd still appreciate this. We're able to do this manually on our end of course, but as mentioned above this is a pretty common use-case that fits the scope of this library if someone on the team can allocate some dev cycles to it.

  7. reopened this on Jun 9, 2026
  8. github-actions commented on Jul 8, 2026

    @github-actions

    Hello, to help manage issues we automatically close stale issues.

    This issue has been automatically marked as stale because it has not had activity for quite some time. If it is still relevant, leave a comment to keep it open.

    This issue will be closed in 15 days if no further activity occurs.

    Thank you for your contributions.

  9. russellwheatley commented on Aug 3, 2026

    @russellwheatley
    Member

    Closing this out due to age. If someone wants to open a PR for it, I'm happy to take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions