#Get pagination end

1 messages · Page 1 of 1 (latest)

dense magnet
#

Is there any way to know if the pagination has ended? (Or if it's the last "page")
When making an infinite scrolling pagination, It's needed to know if the end was reached to stop making requests and loader

swift cypress
#

Hi, are you using cursor or offset pagination right now?

dense magnet
#

@swift cypress Offset pagination

#

I could use cursor if needed to achieve that

swift cypress
#

So, start with a limit of 100 since that is the maximum and and an offset of 0 (the first page).

If the server returns a full page of results (eg, 100 items in this case), then increase the offset by 1 and make another request -> because there are more documents.

Continue doing this until the server returns fewer results than the limit allows (100).

this way, you know you have reached the end

#

Does this make sense?

#

you just need to see the time when less than 100 items are returned since that will be the last

dense magnet
#

Ok, that's what I was doing, but as I see, there's not another way to achieve the same

#

Thanks

swift cypress
dense magnet
#

Also I don't understand why I get 23 elements when having 21