In the implementation details I will not go, as interested in the algorithm for obtaining the records.
Imagine that in the database we have 100 records on the first page we get the first 10 records.
Begin to scroll down the page, click show more, loaded another 10 records.
All is well in this case, while we did not have the time to add records in the database for a while until we watched the first 10.
So, here we got the first 10 records
scroll down, during this time, BD has added a couple of records
when getting the 2nd page of 10 records we would get
get doubles, the first two (
[-1,0] )is not displayed above, since we asked for the 2nd page.
Immediately comes to mind is check the array for duplicates, for example by ID records.
Okay, but what if in the DB in 1 second got 100 records?
2nd page we get
[-90, -89, -88, -87, -86, -85, -8, -83, -82, -81] and when you come back to 0 again we get the double
How can I deal with this problem?