-
Notifications
You must be signed in to change notification settings - Fork 4.5k
core-data: Try using cached permissions even when _fields
is present in the query
#70738
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
_fields
is present in the query_fields
is present in the query
Size Change: +44 B (0%) Total Size: 1.89 MB
ℹ️ View Unchanged
|
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 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. |
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.
This makes sense to me.
Nice work, @priethor! This assumes that people always remember specifying Maybe |
I though |
The |
It seems |
Not exactly, calling it without |
Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com>
Flaky tests detected in 005e49d. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/16345188729
|
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 for the follow-up, @priethor! This looks good to me ✅
…t in the query (WordPress#70738) Co-authored-by: priethor <priethor@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
What?
Enhances
core-data
's resolver to allow caching entity permissions if the data is available, even if the entity is not complete.Why?
Currently, when useEntityRecordsWithPermissions is called with a _fields parameter, permission caching is disabled. For example, if we optimize the post list experiment to only include the fields that are present in the view, this results in individual OPTIONS requests being made for each entity record to check permissions.
How?
By caching permissions from the
_links.targetHints.allow
data already present in the response, eliminating the need for separate OPTIONS requests when using_fields
.Testing Instructions
_fields
to the posts query #70744 and verify in the network console that it's firing one OPTIONS request per post in the tableScreenshots or screencast
Post list experiment currently:

When we optimize the post list experiment as in #70744, the size of the request with the posts query is much smaller, as it doesn't contain unnecessary data like all the posts' content, but we see an OPTIONS request per post:
Once we apply the changes to the resolver in this PR, we only see the original two requests plus a third one that fetches the selected post to preview it, without the options requests:
