-
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
Theme JSON: replace top-level background style objects on merge #66656
Theme JSON: replace top-level background style objects on merge #66656
Conversation
…-level background image objects are not replaced, rather they are merged, which was the state of affairs before #64128
Flaky tests detected in 72a47a3. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11623192696
|
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.
Good catch! Yeah, I could imagine the merge being unexpected if and when we allow the UI to support folks using external urls for background images, too.
The logic looks good to me, and I gave background images in theme.json
and uploaded via the site editor a smoke test with a variety of permutations and didn't run into any issues.
LGTM! 🚀
Thanks for testing!! |
Bit slow to the party (as usual) but this works as advertised for me also. All the merge variations I tried produced the expected results. Thanks for the fix! |
…Press#66656) This commit fixes an omission in the theme json merge logic where top-level background image objects are not replaced, rather they are merged, which was the state of affairs before WordPress#64128 Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
What?
This PR fixes an omission in the theme json merge logic where top-level background image objects are not replaced, rather they are merged, which was the state of affairs before #64128
Blocks are already catered for via
::get_block_nodes()
.Why?
Consider the following: I want to merge existing JSON A with incoming JSON B.
In trunk the outcome would be:
Notice the
"id"
property, which does not belong to the new image. The entire object should be replaced.How?
Add the top-level styles path to the paths to be merged.
Testing Instructions
Run the unit tests:
npm run test:unit:php:base -- --filter WP_Theme_JSON_Gutenberg_Test