Skip to content
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

Suggestion: pagination + take/skip + hasMore + cursor #272

Open
3 tasks
cantoute opened this issue Aug 31, 2022 · 1 comment
Open
3 tasks

Suggestion: pagination + take/skip + hasMore + cursor #272

cantoute opened this issue Aug 31, 2022 · 1 comment
Labels
good first issue Good for newcomers

Comments

@cantoute
Copy link

cantoute commented Aug 31, 2022

It's a common implementation to use pager logic but I'm not super fond of it.

Actually, I don't mind handling skip=pageSize*page front end side.

One simple use case I dislike in page=2 logic is when user changes pageSize.
Trying to guess what page we should go to, and where in the page it'll find the records that where visible at time of page size change. (so easy to simply reuse the current skip)

On the other hand, something I really appreciate to have in the api response is a hasMore or endOfRecords boolean.

As I'm considering using this crud module on a personal project, I thought I could offer to contribute by first adding a few things on the roadmap (and hopefully give a hand).

Suggestions

  • Add a hasMore boolean in the response
  • Add the ability to use skip/take pagination logic
    • exposing take skip in all responses. (?)
    • if page and take/skip present in request throw error.
  • Take advantage of cursor logic
    • this would imply checking orderBy is on a unique key.

Implementing cursor logic would probably be to challenging for me...

@cantoute cantoute changed the title suggestion on pagination Suggestion: pagination + take/skip + hasMore + cursor Aug 31, 2022
@kepelrs
Copy link
Owner

kepelrs commented Nov 20, 2022

I agree that exposing take/skip enables more flexibility in certain scenarios. Will keep it in mind during work planned for upcoming months.

@kepelrs kepelrs added the good first issue Good for newcomers label Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants