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

Update Inner Blocks (ESNext) to use latest API #163

Merged
merged 3 commits into from
Oct 20, 2021

Conversation

ryanwelcher
Copy link
Contributor

Part of the effort in #152

@ryanwelcher ryanwelcher requested review from mkaz and gziolo October 19, 2021 19:16
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's great to see all those updates 👍🏻

const { name, ...settings } = json;

registerBlockType( name, {
...settings,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One note. Technically speaking, you don't need to spread settings here. They are exposed from the server when registered with register_block_type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for confirming that! It was a question that came up in a couple of live streams.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/WordPress/gutenberg/blob/1a3bda10d3d04233e864d89eb9db3ca2adb0e62c/packages/blocks/src/api/registration.js#L258-L271

That means that whatever the client provides overrides what the server provides (if registered also on the server).

If you register blocks only with JavaScript then you surely need to spread settings from block.json here.

Copy link
Member

@gziolo gziolo Oct 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryanwelcher ryanwelcher merged commit 4abe1a9 into trunk Oct 20, 2021
@ryanwelcher ryanwelcher deleted the feature/update-06-inner-blocks-esnext branch October 20, 2021 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants