Description
In packages/block-library/src/navigation/use-navigation-entities.js, the hook fetches all top-level pages through the REST API without specifying _fields:
useEntityRecords( 'postType', 'page', {
parent: 0,
order: 'asc',
orderby: 'id',
per_page: -1,
context: 'view',
} );
This causes the API to return complete page objects – including content, excerpt, meta, guid, modified, template, _links, and many more fields the Navigation block will never use.
Additionally, this request fires every time the Navigation block mounts and re-fires after a post is saved. On sites with a large amount of content within those pages, this can cause noticeable delays and negatively impact the overall editing experience.
Proposed Fix
Add _fields to the query arguments to limit the response to only the required fields (e.g., id, title, slug, parent, menu_order).
useEntityRecords( 'postType', 'page', {
parent: 0,
order: 'asc',
orderby: 'id',
per_page: -1,
context: 'view',
_fields: 'id,title,slug,parent,menu_order',
} );
Step-by-step reproduction instructions
- Add the Navigation block.
- Save the post.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
Description
In packages/block-library/src/navigation/use-navigation-entities.js, the hook fetches all top-level pages through the REST API without specifying _fields:
This causes the API to return complete page objects – including content, excerpt, meta, guid, modified, template, _links, and many more fields the Navigation block will never use.
Additionally, this request fires every time the Navigation block mounts and re-fires after a post is saved. On sites with a large amount of content within those pages, this can cause noticeable delays and negatively impact the overall editing experience.
Proposed Fix
Add
_fieldsto the query arguments to limit the response to only the required fields (e.g., id, title, slug, parent, menu_order).Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.