diff --git a/packages/block-library/src/navigation/edit/index.js b/packages/block-library/src/navigation/edit/index.js index be6f58e1ea875..a4c26c19dd5a2 100644 --- a/packages/block-library/src/navigation/edit/index.js +++ b/packages/block-library/src/navigation/edit/index.js @@ -306,20 +306,6 @@ function Navigation( { ); } - // Show a warning if the selected menu is no longer available. - // TODO - the user should be able to select a new one? - if ( navigationMenuId && isNavigationMenuMissing ) { - return ( -
- - { __( - 'Navigation menu has been deleted or is unavailable' - ) } - -
- ); - } - if ( isEntityAvailable && hasAlreadyRendered ) { return (
diff --git a/packages/block-library/src/navigation/use-navigation-menu.js b/packages/block-library/src/navigation/use-navigation-menu.js index cd58adf0684fa..90e32c88ffb83 100644 --- a/packages/block-library/src/navigation/use-navigation-menu.js +++ b/packages/block-library/src/navigation/use-navigation-menu.js @@ -8,6 +8,7 @@ export default function useNavigationMenu( navigationMenuId ) { return useSelect( ( select ) => { const { + getEntityRecord, getEditedEntityRecord, getEntityRecords, hasFinishedResolution, @@ -18,6 +19,9 @@ export default function useNavigationMenu( navigationMenuId ) { 'wp_navigation', navigationMenuId, ]; + const rawNavigationMenu = navigationMenuId + ? getEntityRecord( ...navigationMenuSingleArgs ) + : null; const navigationMenu = navigationMenuId ? getEditedEntityRecord( ...navigationMenuSingleArgs ) : null; @@ -45,7 +49,7 @@ export default function useNavigationMenu( navigationMenuId ) { isNavigationMenuResolved: hasResolvedNavigationMenu, isNavigationMenuMissing: ! navigationMenuId || - ( hasResolvedNavigationMenu && ! navigationMenu ), + ( hasResolvedNavigationMenu && ! rawNavigationMenu ), canSwitchNavigationMenu, hasResolvedNavigationMenus: hasFinishedResolution( 'getEntityRecords',