-
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
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. |
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.
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
getClientIdsOfDescendants
andgetClientIdsWithDescendants
selectors 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?