-
Notifications
You must be signed in to change notification settings - Fork 683
Window.positionAt should always return exact position of element #3070
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
Comments
This was referenced Mar 26, 2024
One small observation. I believe the way to find out if there are previous results is to check if Window<String> window = Window.from(List.of("a", "b", "c"), OffsetScrollPosition.positionFunction(0));
ScrollPosition pos = window.positionAt(0);
boolean hasPrevious = !pos.isInitial();
assertThat(hasPrevious).isFalse(); |
natedanner
pushed a commit
to natedanner/spring-projects__spring-data-commons
that referenced
this issue
May 20, 2024
…crolling Position. Closes spring-projects#3070 Original pull request: spring-projects#3072
natedanner
pushed a commit
to natedanner/spring-projects__spring-data-commons
that referenced
this issue
May 20, 2024
Introduce method to obtain a position function from OffsetScrollPosition. Tweak documentation wording. See spring-projects#3070 Original pull request: spring-projects#3072
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The current implementation of the
positionAt
method ofWindow
conceptually differs for keyset and offset-based windows.With keyset, the returned
ScrollPosition
contains the exact coordinates used to identify an element.The offset-based variant behaves a little differently in the sense of being 1-based (adding
+1
to the actual offset of the element, pointing not to the element itself but to the next one in the list):The various store implementations currently follow the 1-based offsets. This results in a mixed approach when loading entries from the database by including the element at a given
ScrollPosition
ifScrollPosition.isInitial()
and excluding the position otherwise. There's no way to differentiate betweenScrollPosition.offset()
andScrollPosition.offset(0)
.Going forward, we need to tell implementing stores if the result should contain the element at the
ScrollPosition
or not.Current implementations are using greater than & less than filters for keyset scrolling which means if the element at a given position needs to be part of the result set, an additional entry identifying the element needs to be added to the or concatenated filter.
The text was updated successfully, but these errors were encountered: