Skip to content

Fix pagination continueCursor at end of query #18

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

Merged
merged 2 commits into from
Sep 4, 2024
Merged

Conversation

ldanilek
Copy link
Contributor

@ldanilek ldanilek commented Sep 4, 2024

Fixes #16 and #17


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@@ -371,6 +371,9 @@ class DatabaseFake {
const { value, done } = this.queryNext(queryId);
if (done) {
isDone = true;
// We have reached the end of the query. Return a cursor that indicates
// "end query", which we can do with any string that isn't a valid _id.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is magical but I'll take it

@@ -387,7 +390,7 @@ class DatabaseFake {
return {
page,
isDone,
continueCursor,
continueCursor: continueCursor!,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible there won't be any result & it'll still be null?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope it's an infinite loop with two breaks and we set the variable before each break

@ldanilek ldanilek merged commit ff4c0f6 into main Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong types for PaginationResult
2 participants