Skip to content

Commit

Permalink
Navigation Screen: Fetch all menus for display in <select> menu (#22591)
Browse files Browse the repository at this point in the history
Use an unbounded query (per_page=-1) when fetching menus for display in
the Navigation Screen. Note that fetchAllMiddleware() will translate
this per_page=-1 query into several per_page=100 requests.
  • Loading branch information
noisysocks authored May 29, 2020
1 parent 55c3d44 commit b0458db
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/edit-navigation/src/components/menus-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import MenuEditor from '../menu-editor';
export default function MenusEditor( { blockEditorSettings } ) {
const { menus, hasLoadedMenus } = useSelect( ( select ) => {
const { getMenus, hasFinishedResolution } = select( 'core' );
const query = { per_page: -1 };
return {
menus: getMenus(),
hasLoadedMenus: hasFinishedResolution( 'getMenus' ),
menus: getMenus( query ),
hasLoadedMenus: hasFinishedResolution( 'getMenus', [ query ] ),
};
}, [] );

Expand Down

0 comments on commit b0458db

Please sign in to comment.