DEVs
unread,Jul 21, 2022, 10:52:55 AM7/21/22Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Firebase Google Group
I am working with Firestore right now and have a little bit of a problem with pagination.
Basically, I have a collection (assume 10 items) where each item has some data and a timestamp.
and First 10 items get with snapshot orderBy(createdAt ,desc) after that I take one variable as a last record and i used it in another query as a startAfter clouse but when I add new record then first item is removed
if we have one array in that we have 1 to 50 items then on the first time i get 10 item with snapshot like 1 to 10 and If I add new item then 1 is remove and new item is pushed in array and if I clicked on load more button then in the list i saw 1 is removed
how can I solve this problem?
EX.
In firebase collection Array = [2,3,4,1,8,7,6,9,5,10,13,12,14,11,16,17,18,20,15,19]
first snapshot with order by createdAt desc and limit 5 I get and I also use docChange() method in snapshot
16
17
18
19
20
after i clciked on Load More this is get() method same as above limit ,orderBy and startAfter then I get
11
12
13
.
.
.
20
if i add 21 then I get
11
12
13
14
15
17
18
19
20
21
after reload I get it back in perfect order
My Tasks are:
1.Delete items from array with real time update
2.Edit Items with real time update
3.At the first time I only want to use Snapshot with limit 10
4.After than other record get with simple firestore get() query