diff --git a/packages/block-editor/src/components/list-view/index.js b/packages/block-editor/src/components/list-view/index.js index f79eaeb58cceb..dc3280ec39dbf 100644 --- a/packages/block-editor/src/components/list-view/index.js +++ b/packages/block-editor/src/components/list-view/index.js @@ -69,7 +69,7 @@ function ListView( const { clientIdsTree, draggedClientIds, - selectedBlockParentIds, + selectedBlockParentClientIds, } = useListViewClientIds( blocks ); const { selectBlock } = useDispatch( blockEditorStore ); const selectEditorBlock = useCallback( @@ -150,10 +150,10 @@ function ListView( useEffect( () => { if ( ! hasFocus && - Array.isArray( selectedBlockParentIds ) && - selectedBlockParentIds.length + Array.isArray( selectedBlockParentClientIds ) && + selectedBlockParentClientIds.length ) { - selectedBlockParentIds.forEach( ( clientId ) => { + selectedBlockParentClientIds.forEach( ( clientId ) => { if ( ! expandedState[ clientId ] ) { setExpandedState( { type: 'expand', @@ -162,7 +162,7 @@ function ListView( } } ); } - }, [ hasFocus, selectedBlockParentIds ] ); + }, [ hasFocus, selectedBlockParentClientIds ] ); return ( diff --git a/packages/block-editor/src/components/list-view/use-list-view-client-ids.js b/packages/block-editor/src/components/list-view/use-list-view-client-ids.js index c09f5833def2a..d30ee7dfdfd7f 100644 --- a/packages/block-editor/src/components/list-view/use-list-view-client-ids.js +++ b/packages/block-editor/src/components/list-view/use-list-view-client-ids.js @@ -23,7 +23,7 @@ export default function useListViewClientIds( blocks ) { return { draggedClientIds: getDraggedBlockClientIds(), clientIdsTree: blocks ? blocks : __unstableGetClientIdsTree(), - selectedBlockParentIds: getBlockParents( + selectedBlockParentClientIds: getBlockParents( selectedBlockClientIds[ 0 ], false ),