Closed
Description
openedon Oct 14, 2024
Description
With the changes in #65700, self-nested or circular-nested blocks could cause infinite recursion resulting in crashing the editor.
cc: @youknowriad
Step-by-step reproduction instructions
- Register self-nested or circular-nested blocks. For example:
// Self-nested block
window.wp.blocks.registerBlockType( 'test/self-nested-block', {
title: 'Self-nested Block',
parent: [ 'test/self-nested-block', 'core/group' ],
save: () => {
return '';
}
} );
// Circular-nested blocks
window.wp.blocks.registerBlockType( 'test/self-nested-block-1', {
title: 'Self-nested Block #1',
parent: [ 'test/self-nested-block-2', 'core/group' ],
save: () => {
return '';
}
} );
window.wp.blocks.registerBlockType( 'test/self-nested-block-2', {
title: 'Self-nested Block #2',
parent: [ 'test/self-nested-block-1' ],
save: () => {
return '';
}
} );
- Attempt to open the Inserter from the header toolbar. Note that if the problematic blocks already exist in the page content, the block editor will immediately crash after registering the blocks.
Note that if a visible parent block comes first, e.g. [ 'core/group', 'test/self-nested-block-2' ]
instead of [ 'test/self-nested-block-2', 'core/group' ]
, the infinite recursion will not occur.
Screenshots, screen recording, code snippet
No response
Environment info
- WordPress 6.6.2
- Gutenberg 19.4.0
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment