Skip to content

Fix logic for hasPrevious/hasNext with keyset scrolling #843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rstoyanchev opened this issue Oct 26, 2023 · 0 comments
Closed

Fix logic for hasPrevious/hasNext with keyset scrolling #843

rstoyanchev opened this issue Oct 26, 2023 · 0 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@rstoyanchev
Copy link
Contributor

rstoyanchev commented Oct 26, 2023

At the moment, hasPrevious returns true if ScrollPosition#isInitial at position 0 is false, while for hasNext we rely on Window#hasNext. This works fine for offset scrolling which is always forward, and where the offset value allows checking where we are in the overall result set.

In keyset scrolling, however, we only know if there are more results ahead but not before, and this goes along with the direction of scrolling. For forward-scroll we know hasNext but not hasPrevious. For backward scroll we know hasPrevious, but not hasNext. The GraphQL pagination spec covers this, and allows forward-scroll to return hasPrevious=false if not known, and backward-scroll to return hasNext=false if it is not known.

We need to adjust the logic in hasPrevious/hasNext in keyset scrolling accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant