-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
[RFC] support pagination using cursors #1510
Comments
Good idea. And while we are at it, we could expose a |
Well, perhaps I spoke too soon when I said 'working great'. I don't think my current implementation is suitable as generic DynamoDB client that anyone can use (which I would very much like it to be). My main problem is that I don't know the prev/next cursor keys until the server responds with the contents of the current page. Somehow I need to pass those key to I'm actually considering moving back to What would you guys recommend? another option would be just to have a custom saga that updates the filters with the next/prev keys upon |
using page and perPage is working well for me. still working on supporting CREATE, UPDATE, DELETE |
@yonahforst repo link is a 404 |
Whoops. Had to make it public. Thanks for catching that |
Can you make a PR to add it to the ecosystem section in the documentation ? |
Done. Pr #1518 |
We'd love to see cursor-based pagination support in React Admin. As @yonahforst says above, what's needed is for a way for the How this is best hooked up to the Just noticed #1787, which proposes something similar. @fzaninotto, am I on the right track? |
Changing the |
Thank you very much for the response.
I think you're suggesting adding the cursors to one or more of the individual returned resources' data? In many APIs with cursor-based pagination, the response does not return a cursor per resource, but only cursors that identify the positions at the start/end of the current page. There may be cursors for the previous or next page, even when the page itself is empty. So e.g. associating the cursors with one of the resources may be possible sometimes but not in the general case.
Do you suggest this should use the Thanks! |
The Meanwhile, I think adding filter like @fzaninotto, what do you think about it? PS: there is a comprehensive pagination spec I like. |
Problem with filters is that they are memoized if the user goes out and back to the list view. I managed to put the page and cursor param in the filters, and it works; but now if the user goes back to the list view, they end up on the "last page they've been browsing", instead of starting with page 1 again. |
For now, we got around the issue differently; we store the cursor string value in I wonder how could we change the implementation of those hooks, so that it allows for different format of pagination params, without having to entirely fork those hooks? |
the API for getList is radically different when we use cursors:
However, using typeScript unions, this can be added in a backwards-compatible fashion. We will not address this in 4.0, but maybe in a future minor release. |
We've added Partial Pagination in react-admin 4.0: #7120 |
@fzaninotto in your comment above you suggested an API with |
Since partial pagination doesn't support cursors yet as what's needed here, should we reopen this one? Or better to create a new issue to track? |
Sure, cursor-based pagination would be nice. But we don't keep feature requests open if nobody in the community is willing to contribute an implementation. This is an open-source project, not a free development workshop. If the core team needs it for on of our projects, we'll implement it, and possibly open-source it. We'll welcome any community implementation. If you need this feature and you can't implement it yourself, please sponsor its development. |
The company I work at are using a GraphQL api that uses cursors rather than per page pagination. Currently the contractors who set up our frontend created their own custom list component to support this while re-using most the other react admin components from the list component. They did this quickly, and a little bit of a hack to get it out quickly as we had a deadline. We are also using react-admin Enterprise Edition but I don't think any of those components are used by the list. We may be interested in getting this solved properly in react-admin as we want as little custom code in our project as possible, one of the main reasons for using react-admin. So we don't waste time and effort:
Thank you, |
Hi Owen, No, there is no ongoing implementation for cursor-based pagination We'd be happy to work on it for you. Can you drop an email to our sales jeremie@marmelab.com to continue the conversation? Cheers, François |
I'm in the middle of writing a client for AWS DynamoDB. One of the problems is that the DB uses cursor-based pagination (is that what it's called?)
I'm using a custom reducer to keep track of the previous + next keys, but I need a way to pass those from the
<Pagination/>
component to the client.At first I thought it would be a good idea to allow the page param to be an object, but that got messy quickly. there are several places where it's assumed to be an integer.
However, filters can be objects and maybe that's a better fit anyway. What do you guys thinking about exposing
setFilters
to the<Pagination/>
component?It's working great for me and I have a PR lined up to submit.
The text was updated successfully, but these errors were encountered: