Skip to catalogue

68

pagination

also cursor vs offset

Do not return the whole table. Offset pages lie under inserts. Cursors stay stable.

What is pagination?

Pagination returns a window of a list plus a way to ask for the next window. Offset is `page * size` and skips or duplicates when rows change. A cursor points at the last seen row and asks for what comes after.

Why does pagination matter when vibe coding?

Models `SELECT *` or `LIMIT 1000`. The first demo looks fine. The real tenant has 40,000 rows. Name pagination before the list endpoint exists.

How do you do pagination?

Default a cursor on any list that can grow. Stable sort (created_at, id). Return `next_cursor`. Cap page size. Do not offset a live feed.

How do you ask a model for pagination?

Paginate (list) with a cursor, not OFFSET. Stable order by (field, id). Return next_cursor. Cap page size. Do not load every row.

What goes wrong with pagination?

Infinite scroll on an admin table you must jump around. That wants pages. A feed wants a cursor. Say which.

adjacent