Skip to content
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 type unexpectedly not registered when icon is '' or null in WordPress 5.3 #18894

Closed
danielbachhuber opened this issue Dec 3, 2019 · 2 comments · Fixed by #34350
Closed
Assignees
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Feature] Block API API that allows to express the block paradigm. [Status] In Progress Tracking issues with work in progress

Comments

@danielbachhuber
Copy link
Member

Before WordPress 5.3, it was possible to register a block type using an empty string or null value for icon. This would result in the block type using the default 'block' icon.

In WordPress 5.3, a block type registered with icon: '' or icon: null will trigger this warning:

image

The early return statement added in 1a7255f#diff-bcd12caf7289c956a519c4cd8f3f363eR144-R150 causes the block type to not be registered.

My expectation is that a block type with icon: '' or icon: null would be registered with a default icon.

I took a look at the history of normalizeIconObject (https://github.com/WordPress/gutenberg/blame/a71241ca616642f6f590d6982fd82b46d96158ac/packages/blocks/src/api/utils.js#L85-L106). It seems like the last changes are a year old, so I'm not sure why we're only now experiencing this issue?

@gziolo gziolo added [Feature] Block API API that allows to express the block paradigm. Needs Testing Needs further testing to be confirmed. labels Dec 9, 2019
@tellthemachines tellthemachines added Backwards Compatibility Issues or PRs that impact backwards compatability and removed Needs Testing Needs further testing to be confirmed. labels May 14, 2020
@tellthemachines
Copy link
Contributor

I can confirm that this error is occurring when a block is registered with icon: '' or icon: null.

@gziolo gziolo self-assigned this Aug 27, 2021
@gziolo gziolo added the [Status] In Progress Tracking issues with work in progress label Aug 27, 2021
@gziolo
Copy link
Member

gziolo commented Aug 27, 2021

Opened #34350 to address it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Feature] Block API API that allows to express the block paradigm. [Status] In Progress Tracking issues with work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants