-
-
Notifications
You must be signed in to change notification settings - Fork 766
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
Fixed EfQueryableCursorPagingHandler (hasNextPage & hasPreviousPage) #7506
Fixed EfQueryableCursorPagingHandler (hasNextPage & hasPreviousPage) #7506
Conversation
Thanks for your help! |
src/HotChocolate/Data/src/EntityFramework/Pagination/EfQueryableCursorPagingHandler.cs
Outdated
Show resolved
Hide resolved
fetchCount++; | ||
|
||
if (fetchCount >= requestedCount) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the actual issue was this check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, indeed. If the only change would've been if (fetchCount > requestedCount)
without altering the order (incrementing the count first and then adding the entities), it results in reading and adding one entity too many (first 10 -> returns 11).
Summary of the changes (Less than 80 chars)
Ensure that the
fetchCount
can be greater thanarguments.First
andarguments.Last
therefore settinghasNextPage
andhasPreviousPage
accordinglyAdded tests to check for
hasNextPage
andhasPreviousPage
Closes #7500