Skip to content

Commit

Permalink
Navigation: Remove the check for draft navigation menus from the Unsa…
Browse files Browse the repository at this point in the history
…vedInnerBlocks component
  • Loading branch information
scruffian committed Mar 17, 2023
1 parent 584c1d2 commit 461d4c6
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions packages/block-library/src/navigation/edit/unsaved-inner-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ import useNavigationMenu from '../use-navigation-menu';
import { areBlocksDirty } from './are-blocks-dirty';

const EMPTY_OBJECT = {};
const DRAFT_MENU_PARAMS = [
'postType',
'wp_navigation',
{ status: 'draft', per_page: -1 },
];

const DEFAULT_BLOCK = {
name: 'core/navigation-link',
Expand Down Expand Up @@ -90,28 +85,16 @@ export default function UnsavedInnerBlocks( {
}
);

const { isSaving, hasResolvedDraftNavigationMenus } = useSelect(
const { isSaving } = useSelect(
( select ) => {
if ( isDisabled ) {
return EMPTY_OBJECT;
}

const {
getEntityRecords,
hasFinishedResolution,
isSavingEntityRecord,
} = select( coreStore );
const { isSavingEntityRecord } = select( coreStore );

return {
isSaving: isSavingEntityRecord( 'postType', 'wp_navigation' ),
draftNavigationMenus: getEntityRecords(
// This is needed so that hasResolvedDraftNavigationMenus gives the correct status.
...DRAFT_MENU_PARAMS
),
hasResolvedDraftNavigationMenus: hasFinishedResolution(
'getEntityRecords',
DRAFT_MENU_PARAMS
),
};
},
[ isDisabled ]
Expand All @@ -137,7 +120,6 @@ export default function UnsavedInnerBlocks( {
if (
isDisabled ||
isSaving ||
! hasResolvedDraftNavigationMenus ||
! hasResolvedNavigationMenus ||
! hasSelection ||
! innerBlocksAreDirty
Expand All @@ -160,7 +142,6 @@ export default function UnsavedInnerBlocks( {
createNavigationMenu,
isDisabled,
isSaving,
hasResolvedDraftNavigationMenus,
hasResolvedNavigationMenus,
innerBlocksAreDirty,
hasSelection,
Expand Down

0 comments on commit 461d4c6

Please sign in to comment.