Requirement
- On start 20 items will be loaded.
- When user scrolls to end, 20 more items will be loaded.
Problem
Firestore Query has startAt()
and endAt()
methods which works on value of OrderBy
field. I want something to work on index.
interface Product{
price:number;
}
Suppose there are 100 products for 20$ and 30 products for 10$. First load can be fetched
query
.orderBy(price,desc)
.limitTo(20)
Now price of last item is 20$. To load next 20 results
query
.orderBy(price,desc)
.startAt(20$)
.limitTo(20)
It will return the same result.