Comment

Comment by JimDabell

> Pagination is the devil. The state of the server can change while the user is paginating, leading to fragile clients. Don't paginate your API.

The problem is not pagination, and the solution is not to avoid pagination. The problem is offset-based pagination, and the solution is to use cursor-based pagination.

> If you think you have a need to paginate, have one API call return a list of IDs, and have a separate API call return a list of resources for a given list of IDs, where the second API call accepts some maximum number of IDs as a query parameter.

This has the same problem as you described above. The state of the server can change between fetching the list of IDs and operating on them.

parent JimDabell 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton