-
Notifications
You must be signed in to change notification settings - Fork 40
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
Before & after cursor not behaving correctly #77
Comments
Hi, you you need to remove |
Can you try to set the limit on buildPaginator instead of the query builder? const paginator = buildPaginator({
entity: TestEntity,
alias: 'test',
paginationKeys: ['createdAt', 'id'],
query: {
order: 'DESC',
limit <-- here
},
}); |
I am seeing exact same issue. Here is my code-
@acSpock are you find any solutions for this? |
Hello anyone |
@benjamin658 , I try it with the limit, I am facing the same issue. Please review the code! |
Please make sure that the pagination key "created_at" is table wide unique. |
@benjamin658 Does |
@benjamin658 @kylenguyen-relay
|
I'm puzzled. How is this behavior supposed to work?
current version: 0.10.1
Here's my API response fetching a table with only 18 items in the table:
api/resource?limit=10
so far so good. let's move forward:
api/resource?limit=10&afterCursor=Y3JlYXRlZEF0OjE2Nzc5NjQ1NDg3NzksaWQ6ZDQ5YzA3NjgtNTBlYy00M2I3LWExNzctYjAxNmQ2YjE3YjRm
still... so far so good. Let's go back
api/resource?limit=10&beforeCursor=Y3JlYXRlZEF0OjE2Nzc4MDgzODM1NjgsaWQ6NmYxNGRmZDEtOGQ1Zi00OTZlLTkzZmUtOTc3MDkzMDY5YzAw
mmmm that's a little strange. Data is right, but I'm seeing a beforeCursor again. There shouldn't be, because aren't we back at the beginning of the list?
Let's try going forward 1 more time.
api/resource?limit=10&afterCursor=Y3JlYXRlZEF0OjE2Nzc4MDgzODM1NjgsaWQ6NmYxNGRmZDEtOGQ1Zi00OTZlLTkzZmUtOTc3MDkzMDY5YzAw
That's not right. 7 records.
And if I keep going back and forth, I'll go back to 10 records then if I go forward again, 6 records, then back to 10 records then forward to 5 until it goes down to 0.
Why?
Here's my implementation:
I'm experimenting with cursor pagination and fastify and i'm wondering why this behavior is happening. Any help would be appreciative.
The text was updated successfully, but these errors were encountered: