Hacker News new | ask | show | jobs
by bigmadshoe 15 days ago
Just use cursor based pagination. How is this any different whether it’s infinite scroll or separate pages?
2 comments

Cursor based pagination only works if the items are sorted in strict chronological order. Otherwise, the problem remains. Consider the list

  [A B C] D E F G H …
where the brackets represent the first page. If the user clicks the next page button (asking for the next page after C), but meanwhile the order changed, they get this:

  A D C [B F E] G H …
Notice how they now see B twice and completely miss out on D. In constrast, infinite scroll will take the new infinite list and remove A B C, leaving D F E …
I guess the argument is that, while it's the same whether the user asks for "give me page 3" or "give me scrollbar Y coordinate 2160", the user is more likely to do the first or at least to care about the correctness of its result?
Why does the user need to see a page number? You could just show a “forward” and a “back” button. Keep records of what they’ve seen recently so you can replay prior pages. If they view too many pages just silently drop earlier pages; it’s a feed, not a perfect paginated list.