Pagination not working firebase

I'm trying to implement Pagination using Firebase. I've tried with the code from related issue here:

The methods have changed slightly but my code I'm using (based on your recommendation) is below. It works for the first fetch, on page load. But pressing the next arrow doesn't fetch any more users. The table data remains the same.


Please help!

const TIMESTAMP_KEY = "createdAt"

await db
  .firestore()
  .collection("users")
  .orderBy(TIMESTAMP_KEY, "desc")
  .startAfter(firestore.Timestamp.fromDate(new Date(cursor)))
  .limit(table1.pagination.pageSize || 27)
  .get()
  .then((querySnapshot) => {
    querySnapshot.forEach((doc) => {
      const values = doc.data();
      let createdAtValue = values[TIMESTAMP_KEY];

      createdAtValue = new Date(createdAtValue);
      
      data.push({
        ...values,
        [TIMESTAMP_KEY]: createdAtValue,
      });
    });
  });

return data;

Hi @Joe_dare, I replied to your post with the query and table setting that worked for me to make pagination work with a Firebase db and a table component. You can find it on the original topic. Feel free to ask more questions there if you have any. :slightly_smiling_face: