-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Create unstable selectors for getting all controlled inner blocks #24835
Conversation
Size Change: -21 B (0%) Total Size: 1.17 MB
ℹ️ View Unchanged
|
} = select( 'core/block-editor' ); | ||
const selectedBlockClientId = getSelectedBlockClientId(); | ||
return { | ||
rootBlocks: getBlocks( '', { includeControlledInnerBlocks: true } ), | ||
rootBlocks: __unstableGetBlocksWithControlledInnerBlocks( '' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would something like getBlocksTree
be more clear / succinct? Not sure "with controlled inner blocks" clarifies much at a glance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think that would be a better approach. Indicating that this is "all blocks in the tree of the editor," rather than the blocks attached to a specific block parent. I was struggling over the naming here, so thanks for the suggestion!
0250907
to
1ffddc7
Compare
fa6109b
to
56eec24
Compare
I was thinking about how we might do this, but the consumer needed to be able to get an array of blocks with Thanks for fixing the cache key! |
Not that important anyway, I was just thinking maybe an inline function for getBlock inside getBlockTree could work there. |
closes #24690
Description
Based on discussion here and in slack, this PR moves the code which gets blocks including controlled inner blocks to separate unstable selectors. Previously, this behaviour was accessible via parameters to the normal getBlock/getBlocks selectors.
This changes nothing functionally, just cleans up the API for getBlock/getBlocks.
How has this been tested?
locally, in edit site.
Screenshots
behaviour of block navigation is the same:
Types of changes
Code quality.
Checklist: