Order ids in getClientIdsOfDescendants and getClientIdsWithDescendants selectors#39985
Conversation
|
Size Change: -6 B (0%) Total Size: 1.22 MB
ℹ️ View Unchanged
|
85330cd to
7f0dedc
Compare
|
A quick audit of current usage of this selector in Gutenberg to understand if any consumer may be affected by a change in ordering:
I haven't spotted any other kind of usage in Gutenberg. Of course, the change could still cause breakage for third parties who have come to rely on the current unspecified behaviour. I'd still like @youknowriad's wise eyes on this. Otherwise, LGTM. |
cc @getdave in case this is helpful/actionable feedback for the Nav blocks |
|
Looking into this quickly, I assume we could, for example, replace gutenberg/packages/block-library/src/navigation/edit/inner-blocks.js Lines 63 to 65 in 60827ac with selectedBlockHasDescendants: !! getBlockCount( [
selectedBlockId,
] )?.length,...using the |
|
There's a recent increase in "block selection" (focus) performance metric. See https://codehealth.vercel.app |
|
@youknowriad I've created to #40054 to hopefully counteract any slowdown, though I'm not sure how to reliably test the performance to know if the change actually works. |
What?
This PR changes the
getClientIdsOfDescendantsandgetClientIdsWithDescendantsselectors so that the client ids they return are always ordered according to the order that the blocks actually appear in the post.Why?
See #29739 (comment). This would greatly simplify the Table of Contents block implementation.
How?
Testing Instructions
🤷♂ I guess see if the tests pass?