Playbook

Debugging Pagination Bugs

Pagination bugs hide in boundary math, cursor reuse, and new records arriving between pages.

Pattern

Page boundaries skip, repeat, or leak records under certain offsets or cursors.

warningSymptoms

  • arrow_rightMissing final item
  • arrow_rightDuplicate item across pages
  • arrow_rightDifferent result count than expected

searchWhere to look

  • arrow_rightLimit and offset math
  • arrow_rightCursor encoding
  • arrow_rightSort stability
  • arrow_rightBoundary tests

buildCommon fixes

  • arrow_rightUse stable ordering
  • arrow_rightTest exact page boundaries
  • arrow_rightPrefer cursor semantics for changing data

Practice challenges