-
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
Provide context when blocks.registerBlockType
is applied to deprecations
#36628
Provide context when blocks.registerBlockType
is applied to deprecations
#36628
Conversation
@youknowriad and @mcsf, what are your thoughts on the proposed approach? I can see how filters mixed with deprecations might cause issues. In particular when a filter gets introduced long after the depreciation was created. |
I think it's fine yes. |
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.
Let's get this enhancement included. Thank you for the nice idea 👍🏻
Nice! I missed the ping back in November. Great seeing you here, @ethitter, saudades! 😄 |
Description
The
blocks.registerBlockType
filter is applied both to the block's full settings as well as to the settings for its deprecations. If care is not taken, a change intended for the current block's settings can be applied to one of its deprecations unintentionally, with the potential to break the deprecation. This can be avoided by testing the block's settings before applying changes via the filter, but the block's settings may not always be changed in a way that can easily be discerned. To assist with determining the context in which the filter is applied, the deprecation's settings are passed as a third argument, andnull
is passed when the filter is applied to the block's complete settings.How has this been tested?
Added a filter that expects three arguments, confirmed that received arguments were as expected.
Screenshots
Types of changes
blocks.registerBlockType
that isnull
when filtering the full settings, and contains a deprecation's settings when applied to one of the block's deprecations.Checklist:
*.native.js
files for terms that need renaming or removal).