Skip to content

Commit

Permalink
Fix importing classic menus (#52573)
Browse files Browse the repository at this point in the history
* use the same create hook for classic import

* Remove redundant arg to hook

---------

Co-authored-by: Dave Smith <[email protected]>
  • Loading branch information
2 people authored and tellthemachines committed Jul 14, 2023
1 parent 4df1030 commit 95363ab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/block-library/src/navigation/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function Navigation( {
convert: convertClassicMenu,
status: classicMenuConversionStatus,
error: classicMenuConversionError,
} = useConvertClassicToBlockMenu( clientId );
} = useConvertClassicToBlockMenu( createNavigationMenu );

const isConvertingClassicMenu =
classicMenuConversionStatus === CLASSIC_MENU_CONVERSION_PENDING;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { __, sprintf } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import useCreateNavigationMenu from './use-create-navigation-menu';
import menuItemsToBlocks from '../menu-items-to-blocks';

export const CLASSIC_MENU_CONVERSION_SUCCESS = 'success';
Expand All @@ -21,15 +20,7 @@ export const CLASSIC_MENU_CONVERSION_IDLE = 'idle';
// do not import the same classic menu twice.
let classicMenuBeingConvertedId = null;

function useConvertClassicToBlockMenu( clientId ) {
/*
* The wp_navigation post is created as a draft so the changes on the frontend and
* the site editor are not permanent without a save interaction done by the user.
*/
const { create: createNavigationMenu } = useCreateNavigationMenu(
clientId,
'draft'
);
function useConvertClassicToBlockMenu( createNavigationMenu ) {
const registry = useRegistry();
const { editEntityRecord } = useDispatch( coreStore );

Expand Down

0 comments on commit 95363ab

Please sign in to comment.