Closed oscaroox closed 4 years ago
When my data amount exceeds the default limit of 50, hasPreviouse returns true.
It seems that the third query that fetches additional page info uses the default limit 50 instead of my own set limit.
query for results using my limit of 10
third query using limit of 50 to calculate remaining, hasNext ....
steps to reproduce
plugins settings
cursorMixin({ limit: 50, pageInfo: { total: true, hasNext: true, hasPrevious: true, }, }),
Insert more than the limit
const users = [...Array(60)].map(() => UserModel.query().insert({ firstName: faker.name.firstName(), balance: faker.random.number({ min: 1200, max: 4500 }), }), ); await Promise.all(users);
get the first 10 items
const users = await UserModel.query() .orderBy('id') .limit(10) .cursorPage(); expect(users.pageInfo.hasNext).toBeTruthy(); // returns true expect(users.pageInfo.hasPrevious).toBeFalsy(); // also returns true
Thanks for the issue. This should be fixed in version 1.0.1
When my data amount exceeds the default limit of 50, hasPreviouse returns true.
It seems that the third query that fetches additional page info uses the default limit 50 instead of my own set limit.
query for results using my limit of 10
third query using limit of 50 to calculate remaining, hasNext ....
steps to reproduce
plugins settings
Insert more than the limit
get the first 10 items