Skip to content

Fix logic for hasPrevious/hasNext with keyset scrolling #843

Closed
@rstoyanchev

Description

@rstoyanchev

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions