Pagination Worked… Until Data Changed
Pagination broke in production because page numbers were used instead of stable identifiers.
Users reported: Missing records Duplicate items across pages Random jumps in pagination Everything worked fine in testing.
Pagination was implemented using: page + limit But data was changing: new records inserted old records deleted So page 2 today ≠ page 2 after data update.
Fix:
Use cursor-based pagination instead of page numbers.
Example:
- lastId
- createdAt timestamp
Query:
“Give me next 10 records after this ID”
This keeps pagination stable even when data changes.
Lesson:
Offset pagination works only for static data.
For real systems → always prefer cursor-based pagination.
More Bug of the Days
API Returns Cached Data Even After Update
Your API returns old data even after updating records due to caching issues in browser, CDN, or server.
🐛Search Worked Locally but Failed in Production
A search feature worked perfectly on local data but failed in production because matching was case-sensitive in one environment and inconsistent in real records.
🐛API Working in Postman but Failing in Browser
API works in Postman but fails in browser due to missing CORS configuration.
Get a new Bug of the Day in your inbox
Subscribe to Stack Dev Life — free, no spam, unsubscribe anytime.
Subscribe free →