Large navigation menus load slowly and exhaust server resources #42904
Labels
[Block] Navigation Link
Affects the Navigation Link Block
[Block] Navigation
Affects the Navigation Block
[Type] Bug
An existing feature does not function as intended
[Type] Performance
Related to performance efforts
Description
Our website has a menu with several submenus linking 30-40 pages in all. Loading the full site editor triggers API requests for ALL the pages. This is quite slow and results in multiple HTTP 508 Resource Limit Is Reached. Requests are CPU-limited on the server and our shared hosting environment limits pending requests to 20. This is ample server resources for everything we need except loading the site editor.
The cause seems to be this feature which decorates items if they point at invalid pages. Each page in the menu gets loaded.
https://github.com/WordPress/gutenberg/pull/31716/files
The HTTP 508 responses typically come from page requests with this stack trace:
useSelect @ data.js
useIsInvalidLink @ block-library.js
NavigationLinkEdit @ block-library.js
I would suggest that loading each page in a menu doesn't scale well. I don't know enough to suggest a path forward, but batching requests or at least limiting their concurrency would solve this.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
WordPress 6.0.1
Chrome 103.0.5060.134
Windows 10.0.19043 Build 19043
Theme twentytwentytwo Version 1.2
Server Linux 3.10.0-962.3.2.lve1.5.38.el7.x86_64 x86_64
Web server Apache
PHP 7.4.30
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: