I have a new situation where I am getting extra docs returned from Firestore. In my code, this is repeatable and consistent.
Angular 9.0.6
@angular/fire 5.4.2
The listing:
list(startAfter, pageSize) {
return this.angularFirestore.collection('theEntityName', ref => ref
.orderBy('created', 'desc')
.startAfter(startAfter)
.limit(pageSize))
.valueChanges();
}
For my first call, startAfter = empty string, which seems to consistently start with the first record. Same if I use Timestamp.
Just before this call, another module has made several calls for individual docs
get(id) {
return this.angularFirestore.collection('theEntityName').doc(id).valueChanges();
}
These "gets" are in the first mat-tab (0), and the collection list is in another tab (2).
The first tab works as expected. If I list two cards, which calls two docs, they list fine. This first tab (0) is listing doc ids from Redis and iterating cards that are populating with "get" calls individually.
The first call to the collection list in tab (2) will immediately receive the cards from the first tab, followed by the number in the limit of the listing call. Subsequent paging requests return the expected docs.
So, request 5 docs on tab 0, for example, switch to tab (2) and limit 2, I receive the first two docs from tab (0) followed by the first two docs from the list call. Leave tab (0) at 5 and limit 4 on tab (2) I get the first 4 docs from tab (0) followed by the first 4 from the list call.
I hope this isn't two confusing to understand.
Should Firestore support this where some many individual listings have separate live connections to Firestore, and then support a listing?
Would this be an AngularFire bug?
Is there anything wrong with calling .startAfter('')