-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Block Variation Picker: adds support to declarated icon with src #46373
Block Variation Picker: adds support to declarated icon with src #46373
Conversation
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @gigitux! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
@@ -43,7 +43,7 @@ function BlockVariationPicker( { | |||
<li key={ variation.name }> | |||
<Button | |||
variant="secondary" | |||
icon={ variation.icon } | |||
icon={ variation.icon.src || variation.icon } |
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.
Most code guards against icon being undefined using "variation.icon && variation.icon.src ? variation.icon.src : variation.icon". I guess we can follow a similar approach but other that the change looks good and can be merged after the update.
@jorgefilipecosta Thanks for the review! I updated the check! |
@gigitux given that this PR was approved and you did the change, should we go ahead and merge? |
What?
This PR adds the support of a declared icon with src to the
Block Variation Picker
.Why?
This avoids the crash of the
Block Variation Picker
when a variation has a declared icon with src. Fixes #46372.How?
Testing Instructions
Start Blank
.Block Variation Picker
doesn't crash.Screenshots or screencast
Screen.Capture.on.2022-12-07.at.17-58-27.mp4