-
Notifications
You must be signed in to change notification settings - Fork 4.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
Update which origins are queried for gutenberg_get_global_settings
#45971
Conversation
Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
@ramonjd @andrewserong I wanted to double-check if the logic makes sense to you (how |
$path = array_merge( array( 'blocks', $context['block_name'] ), $path ); | ||
} | ||
|
||
$origin = 'custom'; |
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.
The only logic modified here is how we determine which $origin
to query.
- adds a new condition for themes without
theme.json
- make sure
all
is mapped tocustom
69316a6
to
ec9a865
Compare
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.
@oandregal Approach LGTM, left a few comments with minor improvement suggestions.
ec9a865
to
b0a3cc8
Compare
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.
LGTM, thanks for the updates!
I attached a 'needs dev note' label, know that this is just an update of an existing feature. I tag it, so it can be surfaced again in two or three months when 6.2 release cycle comes to that point (that's just my personal estimate. I have no insight in any planning around 6.2 release cycle.) I will look through other PRs to get the bundle together. @oandregal maybe, you have some bandwidth to write make dev notes while everything is fresh in your mind. There is also a label |
This PR prevents user settings being queried for themes with no theme.json, data they don't have anyway. In terms of API/devexp/user experience this does not change anything, so I guess it does not need a devnote? |
Thanks for the ping — the logic here makes sense to me, in that a theme without its own |
@oandregal It seems I'm a bit late, but the testing instruction says: |
@anton-vlasenko this is certainly weird to test. There's no behavioral change for the user or the developer experience. The only change is that there's one less database query when the theme is classic (which, presumably, results in slightly better performance, data I haven't shared in this PR). Agreed, this function needs more tests. |
Part of #45171
Related #45969
What?
This PR makes sure the settings only query for the data they need.
Why?
We should not do operations that are unnecessary (such as database calls when there is no need).
How?
theme.json
(there is no user data in this case).Testing Instructions
Make sure automated tests pass.