getBlockTransformItems: Support single block object#40718
Conversation
|
Size Change: +4 B (0%) Total Size: 1.23 MB
ℹ️ View Unchanged
|
ntsekouras
left a comment
There was a problem hiding this comment.
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
getBlockTransformItemsselectorblocksarguments. Now it allows passing a single object or array of objects. This matches howgetBlocksByClientIdworks.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, thecreateSelectorreturns 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.