Skip to content

Commit

Permalink
Only try to expand nested branch items where there are parent ids
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Jan 7, 2022
1 parent 3e337c3 commit 4fb80fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/block-editor/src/components/list-view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,11 @@ function ListView(
// for example, in the Block Editor,
// try to expand the block list tree.
useEffect( () => {
if ( ! hasFocus ) {
if (
! hasFocus &&
Array.isArray( selectedBlockParentClientIds ) &&
selectedBlockParentClientIds.length
) {
setExpandedState( {
type: 'expand',
clientIds: selectedBlockParentClientIds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default function useListViewClientIds( blocks ) {
getDraggedBlockClientIds,
getSelectedBlockClientIds,
__unstableGetClientIdsTree,
getSelectedBlockClientIds,
getBlockParents,
} = select( blockEditorStore );
const selectedBlockClientIds = getSelectedBlockClientIds();
Expand Down

0 comments on commit 4fb80fe

Please sign in to comment.