How should a feed be paginated?
Sketch your own answer first, then compare it with the one below.
A strong answer
Use a cursor, not a page number. New posts arrive at the front, so a page number shifts and the next page repeats or skips items.
The cursor names the last item the reader saw, as a time and an id, and the next request asks for older items. Include the id because two posts can share a time. Keep the cursor opaque so you can change it. Refresh asks for items newer than the newest the client holds.
Sources
- Adam Silberstein, Jeff Terrace, Brian F. Cooper, Raghu Ramakrishnan (2010). Feeding Frenzy: selectively materializing users' event feeds.