3 ms·
It isn't really contradictory to have pages and pagination tokens? Just, at the low level, you want dumb API calls. Now, I will assert you are probably better
by taeric 2y ago
It isn't really contradictory to have pages and pagination tokens? Just, at the low level, you want dumb API calls.
Now, I will assert you are probably better off with index like pages, anyway. Instead of numbered, jump to the "g" records. If you insist on page numbers, not too hard to somewhat precalculate what offset each page could be. Just more work, after all.
The advantage of tokenized apis is that you can prevent unbounded work on an API call. In particular, if you allow filters, it is easy to build what has to be a full table scan in one call. This keeps you from later having to build a way to cancel a call.
- tossandthrow 2y agoOffsets only make sense when you have ordered lists. For large scale applications your really can't think about a global total order. This is the reason why a list of pages should not be used with large amounts of data. Also: It is a poor design choice. If you have users that see themselves go to page X, then they don't have the filtering they need.
- taeric 2y agoAgreed. Is why I asserted numbered pages probably aren't best. Still, I know it is a popular ask.