-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Partial pagination #7120
Partial pagination #7120
Conversation
b511c47
to
dfc5254
Compare
first: 'Go to first page', | ||
last: 'Go to last page', | ||
next: 'Go to next page', | ||
previous: 'Go to previous page', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BC spotted: You change prev
for previous
.
Update: Now I see that, technically, it wasn't being used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, I need to add an entry to the Upgrade guide
Co-authored-by: Aníbal Svarcas <[email protected]>
e2e test failing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few linter warnings left, otherwise 💪
Problem
The
getList()
andgetManyReference()
methods return paginated responses. Sometimes, executing a "count" server-side to return thetotal
number of records is expensive.Solution
In this case, you can omit the
total
property in the response, and pass apageInfo
object instead, specifying if there are previous and next pages:React-admin's
<Pagination>
component will automatically handle thepageInfo
object and display the appropriate pagination controls.Enregistrement.de.l.ecran.2022-01-26.a.07.59.25.mov
And while we are at it, time to upgrade to the new MUI
<Pagination>
component!mui-pagination.mov
pageInfo
in the response signature forgetList
andgetManyReference
pageInfo
inuseGetList
pageInfo
inuseGetManyReference
pageInfo
inuseListController
pageInfo
inuseList
pageInfo
inuseReferenceManyFieldController
pageInfo
inuseReferenceInputController
pageInfo
inuseReferenceArrayInputController
<PaginationActions>
to the new MUI<Pagination>
componentCloses #6300 and #5003