diff --git a/packages/block-editor/src/components/block-list/use-block-props/use-block-refs.js b/packages/block-editor/src/components/block-list/use-block-props/use-block-refs.js index 44da41fe8bf91e..56e424319739e1 100644 --- a/packages/block-editor/src/components/block-list/use-block-props/use-block-refs.js +++ b/packages/block-editor/src/components/block-list/use-block-props/use-block-refs.js @@ -93,7 +93,8 @@ function useBlockRef( clientId ) { */ function useBlockElement( clientId ) { const { callbacks } = useContext( BlockRefs ); - const [ element, setElement ] = useState( useBlockRef( clientId ).current ); + const ref = useBlockRef( clientId ); + const [ element, setElement ] = useState( null ); useLayoutEffect( () => { if ( ! clientId ) { @@ -106,7 +107,7 @@ function useBlockElement( clientId ) { }; }, [ clientId ] ); - return element; + return ref.current || element; } export { useBlockRef as __unstableUseBlockRef };