-
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
getBlockTransformItems: Support single block object #40718
Conversation
Size Change: +4 B (0%) Total Size: 1.23 MB
ℹ️ View Unchanged
|
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.
Looks good, thanks George! We could add a tiny unit test for that maybe, but not a big deal 😄
Test that checks that the block object also works or something different? |
What you already did 😄, thanks! |
Added label "needs-dev-note' to flag this for WordPress 6.1 release documentation. @Mamaduka it does seem to just need a mention in the "But there is more" section of the Field Guide, rather than a section in a miscellaneous Dev note post? What do you think? |
This doesn't need a dev note. There a no plugins affected by it, and the updated argument types are documented in the handbook. |
Please don't remove label before the release or at all. Just add a comment why it doesn't need it. If ut' not listed on the tracking issue add the PR number to the comment on the tracking issue |
What?
PR updates
getBlockTransformItems
selectorblocks
arguments. Now it allows passing a single object or array of objects. This matches howgetBlocksByClientId
works.Why?
When trying to get a transformation for a single block, we often have to pass blocks argument like this -
[ getBlock( clientId ) ]
. If arguments aren't referentially equal, thecreateSelector
returns the new value and re-rerenders the component. This can affect performance if left unchecked.Discovered while working on #40696.
How?
The blocks argument now is cast into an array inside the selector.
Testing Instructions
Tests should be passing.