Skip to content

Commit

Permalink
Fix drag and drop to empty block lists (#23923)
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan authored Jul 14, 2020
1 parent e15e810 commit 5d23725
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,17 +322,14 @@ export default function useBlockDropZone( {
useEffect( () => {
if ( position ) {
const blockElements = Array.from( element.current.children );

const targetIndex = getNearestBlockIndex(
blockElements,
position,
orientation
);

if ( targetIndex === undefined ) {
return;
}

setTargetBlockIndex( targetIndex );
setTargetBlockIndex( targetIndex === undefined ? 0 : targetIndex );
}
}, [ position ] );

Expand Down

0 comments on commit 5d23725

Please sign in to comment.