Block editor: Self nesting and circular nesting block fix#66121
Block editor: Self nesting and circular nesting block fix#66121youknowriad merged 5 commits intoWordPress:trunkfrom
Conversation
…etting into the recursion.
|
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. |
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @SH4LIN! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
youknowriad
left a comment
There was a problem hiding this comment.
Changes look good to me. Do you think we can add some unit tests?
t-hamano
left a comment
There was a problem hiding this comment.
I've confirmed that nested blocks cannot be inserted at the root level, and I've also confirmed the browser warning when registering a block that is itself a parent.
At the very least, we may need to add unit tests for registering blocks here.
| if ( | ||
| settings?.parent && | ||
| Array.isArray( settings.parent ) && | ||
| settings.parent.length === 1 && | ||
| settings.parent[ 0 ] === name | ||
| ) { |
There was a problem hiding this comment.
| if ( | |
| settings?.parent && | |
| Array.isArray( settings.parent ) && | |
| settings.parent.length === 1 && | |
| settings.parent[ 0 ] === name | |
| ) { | |
| if ( settings?.parent?.[ 0 ] === name && settings.parent.length === 1 ) { |
Nit: I don't have a strong opinion, but this might be simpler.
There was a problem hiding this comment.
Sure, I'll update the code and add test case
|
@t-hamano @youknowriad I have updated the code LMK if any further changes are required |
|
Thanks for your contribution :) |
Co-authored-by: SH4LIN <sh4lin@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: yuliyan <yuliyan@git.wordpress.org>
closes #66090
What?
false.false.Why?
How?
false.false.Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast
Fixes/Covers