← Changelog
FixedApps

Paging records with after keeps its place while records are written

A page's endCursor used to be a count of records to pass over, so records created or deleted while you paged shifted the next page: newest-first reads repeated records, and others went missing. Cursors now hold the last record's place in the order (its sort values and id), and the next page starts right after it, whatever was written meanwhile.

Pages also go back: findMany with last and before (a page's startCursor) reads the records ahead of it, last alone the final records, and every page answers hasPreviousPage and startCursor. The API takes last and before like first and after, and the test harness pages the same way.

A cursor belongs to the sort and search it was read with: a read with another one now refuses it instead of starting somewhere else. Cursors from before today still read, as do skip and page numbers.

More in Pagination.