-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Blocks: Set default 'apiVersion' for client-side registration #70750
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
d9873af
to
55f9a1e
Compare
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: +10 B (0%) Total Size: 1.89 MB
ℹ️ View Unchanged
|
@@ -78,6 +78,7 @@ export const processBlockType = | |||
const bootstrappedBlockType = select.getBootstrappedBlockType( name ); | |||
|
|||
const blockType = { | |||
apiVersion: 1, |
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.
Like we see by needing to update a bunch of tests, this might break some tests or any custom extension logic that performs strict checking of block type.
With that in mind, should we potentially document it as a breaking change in the package?
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 is more like internal breaking change, shouldn’t affect most of consumers. But I’ll add changelog entry.
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.
LGTM 👍
Good to go after adding a CHANGELOG entry.
Thanks for the feedback, @tyxla! |
As an aside, I think we're being unreasonably conservative with The The Shouldn't we expect all blocks to be compatible with v3 by now? Each version bump is triggered by exactly one change, a rather minor one for most block authors. Is this what @t-hamano aims for with #70743 and related PRs? |
I wish that were the case. However, there are still many blocks that are incompatible with iframes. We've had to revert push for iframed editors, almost every major release I can recall. Issue #70743 is an attempt to find some common ground and encourage developers to make their blocks compatible. |
It's the same in my memory 😅 Personally, I think it would be ok to change the default api version from 1 to 3 if we publish a dev note. |
…ess#70750) * Blocks: Set default 'apiVersion' for client-side registration * Add changelong entry Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org>
What?
PR updates block type processing helper function and sets the default -
apiVersion: 1
.Why?
apiVersion
is always defined during block registration.Testing Instructions
registerBlockType
function.apiVersion
set -wp.blocks.getBlockType( 'test/block-api-version' );
.Example Block
Testing Instructions for Keyboard
Same.