-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Navigation Link: Improve performance by only requesting entities when selected #69633
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
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @dretzlaff. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@@ -111,14 +111,14 @@ const useIsInvalidLink = ( kind, type, id ) => { | |||
// Fetching the posts status is an "expensive" operation. Especially for sites with large navigations. | |||
// When the block is rendered in a template or other disabled contexts we can skip this check in order | |||
// to avoid all these additional requests that don't really add any value in that mode. | |||
if ( blockEditingMode === 'disabled' ) { | |||
if ( blockEditingMode === 'disabled' || ! enabled ) { |
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.
Left blockEditingMode
check. This handles cases when the Navigation block can be selected, but its children have editing disabled.
Size Change: +93 B (+0.01%) Total Size: 1.84 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.
@Mamaduka This is a nice improvement :) I think we need to fine tune it a little bit more though 🤔
In testing this I find it odd that the "invalid" indicator disappears when I have another child of the navigation block selected...
I would kind of like to check if the navigation block is selected or if it has a selection within any of it's child blocks (deeply nested) 🤔
CleanShot.2025-03-19.at.15.39.05.mp4
49f1890
to
f852101
Compare
@fabiankaegy, I updated the checks, and they should be working better. Note: The validation info will disappear when the selection moves out of the navigation block. |
thanks for the PR!
To solve the performance problem, we need to tolerate this behavior, right? |
Yes, it's a trade-off, but minor, in my opinion. |
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.
If we can't solve both problems, I prefer to prioritize improving performance 👍
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.
This works well now :) Thank you!
@Mamaduka I think this one might be worth flagging for a point release. |
… selected (WordPress#69633) * Navigation Link: Improve performance by only requesting entities when selected * Update selector logic for enabling link validation Unlinked contributors: dretzlaff. Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: jordesign <jordesign@git.wordpress.org>
I am checking the PRs with the "Backport to WP Minor Release" label applied to clarify which PRs should be backported to the WordPress 6.8.2 release. This PR does not fix the issues that first appeared in 6.8, but is just a performance improvement and may be a candidate for a minor release. However, note that there is a slight visual change:
|
I think similar performance fixes are okay to backport into a minor release, especially now that there won't be another major release until next year. This is similar to #69627. |
… selected (#69633) * Navigation Link: Improve performance by only requesting entities when selected * Update selector logic for enabling link validation Unlinked contributors: dretzlaff. Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: jordesign <jordesign@git.wordpress.org>
… selected (WordPress#69633) * Navigation Link: Improve performance by only requesting entities when selected * Update selector logic for enabling link validation Unlinked contributors: dretzlaff. Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: jordesign <jordesign@git.wordpress.org>
… selected (#69633) * Navigation Link: Improve performance by only requesting entities when selected * Update selector logic for enabling link validation Unlinked contributors: dretzlaff. Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: jordesign <jordesign@git.wordpress.org>
This PR was cherry-picked into the |
What?
Closes #42904.
Related #69627.
PR improves Navigation Link block performance when loading editors and avoids preemptively requesting item status metadata.
This approach is similar to #17504.
Why?
See: #42904 and #69563.
Testing Instructions
Testing Instructions for Keyboard
Same.
Screenshots or screencast