vedartm / paginate_firestore

A flutter package to simplify pagination with firestore data 🗃
https://pub.dev/packages/paginate_firestore
MIT License
113 stars 138 forks source link

Race condition for live documents #120

Closed garrettApproachableGeek closed 2 years ago

garrettApproachableGeek commented 2 years ago

loadedState is fetched in PaginationCubit within _getLiveDocuments() then it is used within the listen callback when passed to _emitPaginatedState() the loadedState at this point can sometimes contain old data from the previous call to refreshPaginatedList() instead of the new data from state.

The end result of this is that sometimes the list merges the new data into previous data but the previous data from state is empty, instead of actually containing the data from refreshPaginatedList()

garrettApproachableGeek commented 2 years ago

Resolved by https://github.com/vedartm/paginate_firestore/pull/121