-
-
Notifications
You must be signed in to change notification settings - Fork 130
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
Add partial pagination support #297
Add partial pagination support #297
Conversation
Merging for now but you can comment on this PR 🙂 |
I'm not sure I understand the problem. Can you please elaborate? |
Sure. In API Platform we have a partial pagination support: https://api-platform.com/docs/core/pagination/#partial-pagination. It means the API doesn't tell how many pages there are, but only if there is a previous / next page. To fix it, I created a pagination wrapper. Its behavior changes according to the information on the pagination: if the total is given, its the classical pagination, if not it's the previous / next pagination. However, in order to know if the next button needs to be displayed or not, the hydra data provider needs to tell the component if there is a next page or not. In the response format of So I needed to use some tricks (use |
Thanks, it's much clearer. We would need an additional field in the response (I'd call it So let's say that we won't address that use case in react-admin for now. |
OK. And if provide a PR in react-admin, would it be alright? Because I think it would be useful for the Mercure support too (#144). For Mercure, a link to the hub is sent in a response header. But the data provider would have no way to send this link to the components needed to subscribe to the updates. |
Sure: a good way to see if it's not too big a change is to give it a try. Make sure to PR against the |
Add a partial pagination support by adding a custom previous / next pagination component when needed.
It can be considered as a bug fix and as a new feature.
It uses some kind of hack for the hydra data provider to transmit pagination information to the pagination component, by using the
total
prop.I don't think there is a better way to do so without modifying react-admin.
@fzaninotto / @djhi maybe it would be interesting if you could give your point of view?