-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Variations global styles: replace useSetting with useStyle for fetching block variations #73533
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
…ing block variations
| [ name ] | ||
| ); | ||
| const [ variations ] = useSetting( 'variations', name ); | ||
| const [ variations ] = useStyle( 'variations', name ); |
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.
unit tests would have probably caught this. I'll add some
|
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. |
|
Size Change: -3 B (0%) Total Size: 2.54 MB
ℹ️ View Unchanged
|
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 fixing this! The style variations are now appearing correctly, but the preview window is unstyled when selecting them. So for instance in TT5 the Heading block has an Annotation variation, which when selected should display like:
Whereas in this branch the styles aren't apparent in the preview:
Edit: the top screenshot is of WP 6.8 (before the refactor). Any changes to the variation styles should also reflect in that preview, which they aren't right now.
|
To confirm, this bug did not creep in to |
packages/global-styles-ui/src/variations/test/variations-panel.spec.js
Outdated
Show resolved
Hide resolved
|
Flaky tests detected in 4129351. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/19658602102
|
Looks like that's also an existing bug. Good spotting |
I think this bug is separate - from what I can tell the root variation styles that are passed to I'm not sure if they ever were. I don't want to sink time into fixing it here, when we can get the variations at least working by merging this PR. |
andrewserong
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.
This fixes the bug of the variations not displaying. Just giving this the ✅ in case you want to get it in, so we could always look into the block preview issue separately.
It's weird, it's like some of the block style variation styles are present (I see the button within the preview is looking okay), but not the styles at the root of the Group block. Not sure if it's to do with the |
yeah it's a chin scratcher. Thanks for looking more closely. git bisect led me to |
|
I think it's because the options are not passed to |
|
Fix here: #73535 |
What?
The refactor in #72599 used the
useSettinghook to fetch block style variations instead ofuseStyle.This PR fixes that.
Why?
Style variations weren't being rendered to global styles panels.
Testing Instructions
Activate TT5 or some other theme with block variations.
Head to
/wp-admin/site-editor.php?p=%2Fstyles§ion=%2Fblocks%2Fcore%252Fgroup(using TT5, which has group variations)Check that you can see the variations.