Hacker News new | ask | show | jobs
by JadedBlueEyes 665 days ago
Author here! This might be a case for one of the methods I missed, mentioned on the Reddit thread [0]. I've heard it called Cursor-based pagination or searchID-based pagination. The basic idea is you sort everything once and take a snapshot of the result. The user then gets an ID that refers to this snapshot. This often means that `next_page`/`previous_page` are opaque identifiers.

The tradeoff here is now you've got to keep that copy around - your server has to maintain some kind of state, you've got to garbage collect unused snapshots and it's impractical to scale this to millions of items.

[0]: https://old.reddit.com/r/programming/comments/1ev9hha/the_po...