I'm trying to develop a 'infinite scroll' like application using documentdb
as source of data.
Basically when the user loads the website page it gets 5 records and a continuationToken
, on the client I have a JavaScript array which I concat with these records and display on the website. Then the user scrolls down and I send the next request with the continuationToken
and get more 5 results until the server sends me everything and the continuationToken
comes null again and then if the user scrolls down the array will be concat with repeated records infinitely.
I would like to know if there's some way to know that the last record was sent or I need to deal with it on the client?
The only marker from DocumentDB that indicates that there are no more results is a null continuationToken
. So you have to add logic in the client that when this is null, there are no more results to load.