Open johnbillion opened 3 years ago
I recently refactored the <PostAuthor/>
component, which reduced the number of REST API requests - #33695.
But it would be interesting to see the "on-demand" pattern for data fetching. It can be useful for other components too.
Describe the bug
When loading the post editing screen, the
<PostAuthor/>
component triggers a REST API request (viagetAuthors()
) to fetch the authors to list to populate its filterable list. If the user isn't planning on changing the post author, this is an unnecessary REST API request and a waste of resources.This request should be performed on-demand, for example when the field gains focus.
To reproduce
wp-json/wp/v2/users
is performedEditor version (please complete the following information):