-
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
Disabling a block causes editor to crash if preview contains disabled block #54786
Comments
Workaround: import { addFilter } from '@wordpress/hooks';
// ....
addFilter(
'blocks.registerBlockType',
'<NAMESPACE>',
( settings, name ) => {
if ( name === 'core/columns' ) {
delete settings.example;
}
return settings;
}
); |
@kevin940726, do you remember the reason for throwing an error in |
I believe I merely moved it from the original I don't know about the details sorry 😅. |
Thanks for the context, @kevin940726! |
This code appears to have been added intentionally to prevent errors that occur when attempting to register a block that was not originally registered with create-block 🤔 |
Description
Disabling the
core/image
block causes the editor to crash when trying to insert a columns block using the inserter.I'm guessing this happens because the
core/columns
block's example contains an image:gutenberg/packages/block-library/src/columns/index.js
Line 41 in bfd3bb7
The editor should check that all necessary blocks are enabled before trying to render a preview.
Possible workaround: Can the
core/columns
block`s preview somehow be overriden/disabled?Step-by-step reproduction instructions
The bug is reproducible using https://developer.wordpress.org/playground.
core/image
block by executingwp.blocks.unregisterBlockType('core/image')
in the browser consolecore/columns
block using the block inserterScreenshots, screen recording, code snippet
Browser console (with SCRIPT_DEBUG=true)
Environment info
WP 6.3, Gutenberg plugin is not installed
Browser: Google Chrome 117.0.5938.92
OS: Linux x64
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: