A
A
Alexey Konovalov2019-06-14 12:44:03
API
Alexey Konovalov, 2019-06-14 12:44:03

How to avoid duplicate posts in pagination?

Hello!
I undertook to write my own API and look at the VKontakte API as an example. But I noticed such nonsense. In order to get the first group (page) of 10 posts, you need to run a query with parameters count=10&offset=0 .
All is well, but suppose while the user was reading these 10 posts, someone added 5 more posts. It turns out that when I receive the second group of posts with parameters count=10&offset=10 , I will get posts from 5 to 10 of the first request again. Because the offset value for posts has shifted due to 5 new ones.
How is this problem solved by VKontakte? After all, they do not have additional parameters such as the anchor of the first or last post.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question