diff --git a/packages/block-editor/src/components/index.js b/packages/block-editor/src/components/index.js index b944ac97275fac..2d92fe962aadef 100644 --- a/packages/block-editor/src/components/index.js +++ b/packages/block-editor/src/components/index.js @@ -121,6 +121,7 @@ export { default as WritingFlow } from './writing-flow'; export { useCanvasClickRedirect as __unstableUseCanvasClickRedirect } from './use-canvas-click-redirect'; export { default as useBlockDisplayInformation } from './use-block-display-information'; export { default as __unstableIframe } from './iframe'; +export { default as __experimentalUseNoRecursiveRenders } from './use-no-recursive-renders'; /* * State Related Components diff --git a/packages/block-library/src/block/use-no-recursive-renders.js b/packages/block-editor/src/components/use-no-recursive-renders/index.js similarity index 100% rename from packages/block-library/src/block/use-no-recursive-renders.js rename to packages/block-editor/src/components/use-no-recursive-renders/index.js diff --git a/packages/block-library/src/block/test/use-no-recursive-renders.js b/packages/block-editor/src/components/use-no-recursive-renders/test/use-no-recursive-renders.js similarity index 96% rename from packages/block-library/src/block/test/use-no-recursive-renders.js rename to packages/block-editor/src/components/use-no-recursive-renders/test/use-no-recursive-renders.js index a9d9f6e53b789a..0844dd601b3a25 100644 --- a/packages/block-library/src/block/test/use-no-recursive-renders.js +++ b/packages/block-editor/src/components/use-no-recursive-renders/test/use-no-recursive-renders.js @@ -7,6 +7,7 @@ import { render } from '@testing-library/react'; * WordPress dependencies */ import { Fragment } from '@wordpress/element'; +import { __experimentalUseNoRecursiveRenders as useNoRecursiveRenders } from '@wordpress/block-editor'; // Mimics a block's Edit component, such as ReusableBlockEdit, which is capable // of calling itself depending on its `ref` attribute. @@ -37,11 +38,6 @@ function Edit( { attributes: { ref } } ) { ); } -/** - * Internal dependencies - */ -import useNoRecursiveRenders from '../use-no-recursive-renders'; - describe( 'useNoRecursiveRenders', () => { it( 'allows a single block to render', () => { const { container } = render( diff --git a/packages/block-library/src/block/edit.js b/packages/block-library/src/block/edit.js index 09b4f058a5227a..36dfe86da95f15 100644 --- a/packages/block-library/src/block/edit.js +++ b/packages/block-library/src/block/edit.js @@ -18,6 +18,7 @@ import { import { __ } from '@wordpress/i18n'; import { __experimentalUseInnerBlocksProps as useInnerBlocksProps, + __experimentalUseNoRecursiveRenders as useNoRecursiveRenders, InnerBlocks, BlockControls, InspectorControls, @@ -26,11 +27,6 @@ import { } from '@wordpress/block-editor'; import { store as reusableBlocksStore } from '@wordpress/reusable-blocks'; -/** - * Internal dependencies - */ -import useNoRecursiveRenders from './use-no-recursive-renders'; - export default function ReusableBlockEdit( { attributes: { ref }, clientId } ) { const [ hasAlreadyRendered, RecursionProvider ] = useNoRecursiveRenders( ref