-
Notifications
You must be signed in to change notification settings - Fork 4.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
Query: Remove 'inherit' override from query block attributes #67336
base: trunk
Are you sure you want to change the base?
Query: Remove 'inherit' override from query block attributes #67336
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 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. |
Based on the method comment, I think the behavior is intentional. Variations and patterns need to specify if they're not using an @ntsekouras, can you firm this? |
That's what I thought too. But even if the inherit value is set to false, it gets overwritten to true, and this in turn overrides the perPage already set in the pattern to a more generic value set in reading settings or defaults to just 10. I think the perPage if declared inside the pattern must be prioritised over the more generic reading settings. Or perhaps, we can use this approach: block.attributes.query = {
...block.attributes.query,
postType,
inherit: block.attributes.query.inherit ?? inherit,
}; Here, if the inherit value is omitted altogether, we can use the default inherit value of the query block. Please let me know which direction to proceed with so that I can make the changes accordingly in the proposed PR. |
Thanks for the PR! I think it makes sense to preserve the Just noting some recent updates that might be relevant here:
I'll cc @mikachan as well for any thoughts. |
The change to the default value of inherit is an issue for patterns that include multiple queries such as the Twenty Twenty Four pattern Grid of posts featuring the first post, 2 columns because the second query is intended to have an offset number to match the queried post number from the first query. |
Fixes: #67288
What?
This PR removes the logic that tends to override the inherit value with the block's inherit value ( which is set to True by default ) leading to a bug where, if in the Pattern, we've specified inherit as false, then that gets overwritten to True which can potentially also ignore the perPage being set for the query block in the pattern. Better explained here: #67288 (comment)
How?
By removing the override of inherit, the bug was resolved.
Testing Instructions
Screenshots or screencast
Screen.Recording.2024-11-27.at.11.29.50.AM.mov