spring-data-commons icon indicating copy to clipboard operation
spring-data-commons copied to clipboard

Investigate possibility of `Window.hasPrevious()`

Open mp911de opened this issue 2 years ago • 1 comments

For scrolling across results, we already provide a hasNext indicator. It would be good to have a hasPrevious state as well.

For offset-based scrolling, we can get the information from the offset (e.g. a scroll that starts at offset 1 will not have a previous page). For keyset-scrolling, we would need to read from the current cursor and read another item more (two more in total) to determine a previous and next indicator).

mp911de avatar Mar 20 '23 10:03 mp911de

It seems sufficient to check the scrollPosition that was passed to the query. If the isInitial() method on the passed ScrollPosition returns false, we can assume that there is a previous window.

arturs678 avatar Apr 06 '25 13:04 arturs678