Skip to content

🐛 [firebase_ui_firestore] 50k reads for a list of 1000 docs #565

@TimBaumgart

Description

@TimBaumgart

Is there an existing issue for this?

  • I have searched the existing issues and found no duplicates.

What plugin is this bug for?

Firebase UI Firestore

What platform(s) does this bug affect?

Android, iOS, Web, macOS, Linux, Windows

List of dependencies used.

flutter pub deps -s list
  

Steps to reproduce

  1. create 1000 firestore documents
  2. use package to create a list view that scrolls thru all of them
  3. check usage stats in firebase console

Expected Behavior

scrolling thru 1000 documents should result in ~1000 reads (or some more for the pagination overhead)

Actual Behavior

scrolling thru 1000 documents with a page size of 10 results in ~50k reads

Additional Information

Pagination in this package currently works as follows:
Initially, 10 documents are fetched (10 reads). Then, the query limit is increased by 10 to fetch 10 more documents, resulting in a total of 20 reads (10 + 20 = 30 reads). This pattern continues. For example, at page 10, the total number of reads becomes 10 + 20 + ... + 90 + 100 = 550 reads. At page 100, this grows to approximately 50,000 reads, which makes the package impractical for handling long lists.

A more efficient approach would be to keep the query limit fixed at pageSize and use startAfterDocument() to fetch subsequent pages. I’m currently developing a widget using this method—scrolling through a list of 1,000 documents results in only 1,001 reads (including one extra read to confirm the end of the list).

If there’s interest, I’d be happy to create a merge request to add this functionality to the package. Otherwise, I’m considering releasing it as a standalone package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs AttentionOP created or responded to issue and it needs attention.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions