Skip to content

Commit

Permalink
Block Editor: Improve empty getBlockParents() perf
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Feb 21, 2023
1 parent 08f65dc commit 8879f41
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,10 @@ export const getBlockParents = createSelector(
parents.push( current );
}

if ( ! parents.length ) {
return EMPTY_ARRAY;
}

return ascending ? parents : parents.reverse();
},
( state ) => [ state.blocks.parents ]
Expand Down

0 comments on commit 8879f41

Please sign in to comment.