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
draganescu and getdave authored Jul 13, 2023
1 parent 9ea90f0 commit 032b261
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 @@ -197,7 +197,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

1 comment on commit 032b261

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 032b261.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5543328797
📝 Reported issues:

Please sign in to comment.