diff --git a/packages/edit-navigation/src/components/add-menu/index.js b/packages/edit-navigation/src/components/add-menu/index.js index 9843b6a051b993..2f5377d00e2770 100644 --- a/packages/edit-navigation/src/components/add-menu/index.js +++ b/packages/edit-navigation/src/components/add-menu/index.js @@ -12,6 +12,7 @@ import { TextControl, Button } from '@wordpress/components'; import { useFocusOnMount } from '@wordpress/compose'; import { __, sprintf } from '@wordpress/i18n'; import { store as noticesStore } from '@wordpress/notices'; +import { store as coreStore } from '@wordpress/core-data'; const menuNameMatches = ( menuName ) => ( menu ) => menu.name.toLowerCase() === menuName.toLowerCase(); @@ -29,7 +30,7 @@ export default function AddMenu( { noticesStore ); const [ isCreatingMenu, setIsCreatingMenu ] = useState( false ); - const { saveMenu } = useDispatch( 'core' ); + const { saveMenu } = useDispatch( coreStore ); const inputRef = useFocusOnMount( focusInputOnMount ); diff --git a/packages/edit-navigation/src/components/layout/shortcuts.js b/packages/edit-navigation/src/components/layout/shortcuts.js index 9c2e228b4cc0e9..ab03b25e7cd3a7 100644 --- a/packages/edit-navigation/src/components/layout/shortcuts.js +++ b/packages/edit-navigation/src/components/layout/shortcuts.js @@ -8,6 +8,7 @@ import { store as keyboardShortcutsStore, } from '@wordpress/keyboard-shortcuts'; import { __ } from '@wordpress/i18n'; +import { store as coreStore } from '@wordpress/core-data'; function NavigationEditorShortcuts( { saveBlocks } ) { useShortcut( @@ -21,7 +22,7 @@ function NavigationEditorShortcuts( { saveBlocks } ) { } ); - const { redo, undo } = useDispatch( 'core' ); + const { redo, undo } = useDispatch( coreStore ); useShortcut( 'core/edit-navigation/undo', ( event ) => { diff --git a/packages/edit-navigation/src/hooks/use-menu-entity.js b/packages/edit-navigation/src/hooks/use-menu-entity.js index d6a00a7e694fa3..7d3946e201a06a 100644 --- a/packages/edit-navigation/src/hooks/use-menu-entity.js +++ b/packages/edit-navigation/src/hooks/use-menu-entity.js @@ -2,19 +2,20 @@ * WordPress dependencies */ import { useSelect, useDispatch } from '@wordpress/data'; +import { store as coreStore } from '@wordpress/core-data'; /** * Internal dependencies */ import { MENU_KIND, MENU_POST_TYPE } from '../constants'; export default function useMenuEntity( menuId ) { - const { editEntityRecord } = useDispatch( 'core' ); + const { editEntityRecord } = useDispatch( coreStore ); const menuEntityData = [ MENU_KIND, MENU_POST_TYPE, menuId ]; const editedMenu = useSelect( ( select ) => menuId && - select( 'core' ).getEditedEntityRecord( ...menuEntityData ), + select( coreStore ).getEditedEntityRecord( ...menuEntityData ), [ menuId ] ); diff --git a/packages/edit-navigation/src/hooks/use-menu-notifications.js b/packages/edit-navigation/src/hooks/use-menu-notifications.js index bedcbd8cb7901e..8ff8d4f028affa 100644 --- a/packages/edit-navigation/src/hooks/use-menu-notifications.js +++ b/packages/edit-navigation/src/hooks/use-menu-notifications.js @@ -4,6 +4,7 @@ import { useSelect, useDispatch } from '@wordpress/data'; import { useEffect } from '@wordpress/element'; import { store as noticesStore } from '@wordpress/notices'; +import { store as coreStore } from '@wordpress/core-data'; /** * Internal dependencies */ @@ -12,11 +13,11 @@ import { MENU_POST_TYPE, MENU_KIND } from '../constants'; export default function useMenuNotifications( menuId ) { const { lastSaveError, lastDeleteError } = useSelect( ( select ) => ( { - lastSaveError: select( 'core' ).getLastEntitySaveError( + lastSaveError: select( coreStore ).getLastEntitySaveError( MENU_KIND, MENU_POST_TYPE ), - lastDeleteError: select( 'core' ).getLastEntityDeleteError( + lastDeleteError: select( coreStore ).getLastEntityDeleteError( MENU_KIND, MENU_POST_TYPE, menuId diff --git a/packages/edit-navigation/src/store/selectors.js b/packages/edit-navigation/src/store/selectors.js index 9cfbed52cc8642..764c7effc7c69d 100644 --- a/packages/edit-navigation/src/store/selectors.js +++ b/packages/edit-navigation/src/store/selectors.js @@ -7,6 +7,7 @@ import { invert } from 'lodash'; * WordPress dependencies */ import { createRegistrySelector } from '@wordpress/data'; +import { store as coreStore } from '@wordpress/core-data'; /** * Internal dependencies @@ -43,7 +44,7 @@ export const getNavigationPostForMenu = createRegistrySelector( if ( ! hasResolvedNavigationPost( state, menuId ) ) { return null; } - return select( 'core' ).getEditedEntityRecord( + return select( coreStore.name ).getEditedEntityRecord( NAVIGATION_POST_KIND, NAVIGATION_POST_POST_TYPE, buildNavigationPostId( menuId ) @@ -59,7 +60,9 @@ export const getNavigationPostForMenu = createRegistrySelector( */ export const hasResolvedNavigationPost = createRegistrySelector( ( select ) => ( state, menuId ) => { - return select( 'core' ).hasFinishedResolution( 'getEntityRecord', [ + return select( + coreStore.name + ).hasFinishedResolution( 'getEntityRecord', [ NAVIGATION_POST_KIND, NAVIGATION_POST_POST_TYPE, buildNavigationPostId( menuId ), @@ -77,6 +80,6 @@ export const hasResolvedNavigationPost = createRegistrySelector( export const getMenuItemForClientId = createRegistrySelector( ( select ) => ( state, postId, clientId ) => { const mapping = invert( state.mapping[ postId ] ); - return select( 'core' ).getMenuItem( mapping[ clientId ] ); + return select( coreStore.name ).getMenuItem( mapping[ clientId ] ); } );