diff --git a/packages/block-library/src/page-list/edit.js b/packages/block-library/src/page-list/edit.js index b3d2db31d5e04a..7372191723f466 100644 --- a/packages/block-library/src/page-list/edit.js +++ b/packages/block-library/src/page-list/edit.js @@ -25,7 +25,7 @@ import { Button, } from '@wordpress/components'; import { __, sprintf } from '@wordpress/i18n'; -import { useMemo, useState, useEffect } from '@wordpress/element'; +import { useMemo, useState } from '@wordpress/element'; import { useEntityRecords } from '@wordpress/core-data'; import { useSelect, useDispatch } from '@wordpress/data'; @@ -39,6 +39,7 @@ import { convertDescription } from './constants'; // We only show the edit option when page count is <= MAX_PAGE_COUNT // Performance of Navigation Links is not good past this value. const MAX_PAGE_COUNT = 100; +const NOOP = () => {}; export default function PageListEdit( { context, @@ -49,8 +50,6 @@ export default function PageListEdit( { const { parentPageID } = attributes; const [ pages ] = useGetPages(); const { pagesByParentId, totalPages, hasResolvedPages } = usePageData(); - const { replaceInnerBlocks, __unstableMarkNextChangeAsNotPersistent } = - useDispatch( blockEditorStore ); const isNavigationChild = 'showSubmenuIcon' in context; const allowConvertToLinks = @@ -133,6 +132,9 @@ export default function PageListEdit( { renderAppender: false, __unstableDisableDropZone: true, templateLock: 'all', + onInput: NOOP, + onChange: NOOP, + value: blockList, } ); const getBlockContent = () => { @@ -185,13 +187,6 @@ export default function PageListEdit( { } }; - useEffect( () => { - __unstableMarkNextChangeAsNotPersistent(); - if ( blockList ) { - replaceInnerBlocks( clientId, blockList ); - } - }, [ clientId, blockList ] ); - const { replaceBlock, selectBlock } = useDispatch( blockEditorStore ); const { parentNavBlockClientId } = useSelect( ( select ) => {