[firebase_ui_firestore] Support alternative logic for determining if there are more documents in FirestoreListView/FirestoreQueryBuilder #120
rorystephenson
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The FirestoreListView/FirestoreQueryBuilder widgets determine if there are more pages or not by always fetching one extra page and checking if it exists. This is elegant but leads to an extra read for every page. In my case I have a small page (2) size because the widgets displayed are large and thus this extra read leads to 50% extra reads. The data I am paging is ordered by a value which allows me to determine if it is the last page or not and thus an extra document read is not necessary, it would suffice to check this value in the returned documents (e.g. if an attribute itemIndex is 0 we know there are no more documents).
This could be implemented by an optional callback e.g.
isLastSnapshot
which accepts the snapshot and returns true if it is the last one. When this callback is present the page limit would not need to be increased by one.Beta Was this translation helpful? Give feedback.
All reactions