fix(offset): correct StartCursor and EndCursor to reference current page items#17
Merged
josemarluedke merged 1 commit intomainfrom Dec 29, 2025
Merged
fix(offset): correct StartCursor and EndCursor to reference current page items#17josemarluedke merged 1 commit intomainfrom
josemarluedke merged 1 commit intomainfrom
Conversation
…age items Previously, StartCursor always returned offset 0 and EndCursor returned the offset to the last page of the entire dataset. This caused pagination to jump incorrectly when using cursors to navigate between pages. Now both cursors correctly point to items on the current page: - StartCursor: first item on current page - EndCursor: last item on current page (accounting for partial pages) This fixes the issue where requesting a second page would jump to an incorrect offset (e.g., offset 420 instead of offset 10). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a critical bug in offset-based pagination where
StartCursorandEndCursorwere pointing to incorrect positions, causing pagination to jump to wrong offsets when navigating between pages.The Problem
StartCursoralways returned offset 0 (first page of entire dataset)EndCursorreturned the offset to the last page of the entire dataset instead of the last item on the current pageThis caused pagination to jump incorrectly. For example, with 428 total records and page size 10:
EndCursorpointing to offset 420 (last page)The Fix
Both cursors now correctly reference items on the current page:
StartCursor: Returns cursor of the first item on current page (currentOffset + 1)EndCursor: Returns cursor of the last item on current page, accounting for partial pages at the endnilChanges
buildOffsetPageInfoinoffset/paginator.goto calculate cursors based on current page positionoffset/paginator_test.goto verify correct cursor behaviorTest Plan
🤖 Generated with Claude Code