Gutenberg: What is the safe migration process for block structure upgrades?

Created on 19 Oct 2018  路  4Comments  路  Source: WordPress/gutenberg

Added a default class to block, after that Gutenberg editor is unable to load.
Screenshot: https://i.gyazo.com/d594b814e9c6da841e50c3b3cfa83edd.png

Page update -> Reload works but is not ideal since there are tons of pages that are affected by this change.

[Type] Question

Most helpful comment

Sounds like the block deprecation API is what you need since you changed the expected block markup. Especially this example should be useful for you:

https://wordpress.org/gutenberg/handbook/block-api/deprecated-blocks/#changing-the-attributes-set

All 4 comments

Can you perhaps elaborate a bit on that? Are you referring to a custom block whose output you have changed? Also, what kind of errors do you see in the browser's developer tools console (press F12)?

It is a customized section block, yes.

Error in console referring to this issue:

index.js?ver=1540110273:2 Block validation: Expected attribute `class` of value `wp-block-cgb-block-cr-gutenblock wp-block-cxl-section custom-class`, saw `wp-block-cgb-block-cr-gutenblock wp-block-cxl-section`.

"Resolve" does not actually resolve the issue, it converts to previous version rather than new, updated structure.
And "Convert to HTML" is not ideal either, because after that block configurations are not available for use.

Sounds like the block deprecation API is what you need since you changed the expected block markup. Especially this example should be useful for you:

https://wordpress.org/gutenberg/handbook/block-api/deprecated-blocks/#changing-the-attributes-set

Thanks, that helped a ton!

Was this page helpful?
0 / 5 - 0 ratings