-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Core Data: Add 'supportsPagination' to all appropriate entities #71302
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
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @yeetien. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
We should also enable it for individual taxonomies, like Category - https://developer.wordpress.org/rest-api/reference/categories/#arguments. Update: gutenberg/packages/core-data/src/entities.js Lines 383 to 398 in 79e96b5
|
|
Size Change: +15 B (0%) Total Size: 1.92 MB
ℹ️ View Unchanged
|
So not a blanket rule in |
|
The |
…ents, and plugins. This is so totalItems and totalPages is correctly set in meta from the X headers
cc4955e to
bf36045
Compare
Mamaduka
left a comment
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.
Let's merge this ✅
Note: This is basically the "Obama Medal" meme, but with @ramonjd and me 🏅
|
Flaky tests detected in bf36045. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/17207150523
|
Thank you @Mamaduka |
|
Sorry, folks, I am out of practice, I forgot the following in the commit 🤦🏻 |
priethor
left a comment
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.
Thanks all, I was going to fix this for taxonomies, so seeing this was a pleasant surprise ❤️

What? How? Why?
This PR adds the
supportsPaginationproperty to rootEntitiesConfig for user, comment, and taxonomy entities.This is so
totalItemsandtotalPagesare correctly set in meta from theX-WP-TotalandX-WP-TotalPagesheaders.Also, to quote #55164
An example use case would be rendering a dataviews list of comments or users, and accurate totals are required.
See: https://github.com/WordPress/gutenberg/blob/add/entities-support-pagination/packages/core-data/src/resolvers.js#L281
Closes #59520
Testing Instructions
I tested by adding a lot of users, e.g.,
Then I fetched users:
This will return 10 entries by default.
Then I checked the total:
This should return 150 (plus how many users you had already).
In trunk, you'd see
10because that's how many users are in the store.