-
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
Improve the getBlock and getBlocks performance #34241
Changes from all commits
3ba3aec
4c588a7
7b954f2
b0f1d61
d95df71
1454d6d
d53937a
a741d27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,7 +199,7 @@ export default compose( [ | |
isBlockInsertionPointVisible, | ||
getSettings, | ||
getBlockParents, | ||
__unstableGetBlockWithoutInnerBlocks, | ||
getBlock, | ||
} = select( blockEditorStore ); | ||
|
||
const blockClientIds = getBlockOrder( rootClientId ); | ||
|
@@ -225,14 +225,11 @@ export default compose( [ | |
|
||
const isReadOnly = getSettings().readOnly; | ||
|
||
const block = __unstableGetBlockWithoutInnerBlocks( clientId ); | ||
const { attributes, name } = block || {}; | ||
const { attributes, name } = getBlock( clientId ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess it can in some rare occasions, I'll restore the fallback. |
||
const { align } = attributes || {}; | ||
const parents = getBlockParents( clientId, true ); | ||
const hasParents = !! parents.length; | ||
const parentBlock = hasParents | ||
? __unstableGetBlockWithoutInnerBlocks( parents[ 0 ] ) | ||
: {}; | ||
const parentBlock = hasParents ? getBlock( parents[ 0 ] ) : {}; | ||
const { align: parentBlockAlignment } = | ||
parentBlock?.attributes || {}; | ||
const { name: parentBlockName } = parentBlock || {}; | ||
|
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.
Was catching up with this PR and wanted to bring attention to this comment.
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'll need to deprecate this action properly, it's not used anywhere.