Skip to content

Commit

Permalink
Don't bother sorting if there are no proitizedInnerBlocks
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj committed May 9, 2023
1 parent bc6aad1 commit cd5ccf9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/block-editor/src/components/list-view/appender.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ export const Appender = forwardRef(
}, [ insertedBlockTitle ] );

const orderInitialBlockItems = useCallback( ( items ) => {
if ( ! prioritizedInserterBlocks.length ) {
return items;
}

items.sort( ( { id: aName }, { id: bName } ) => {
// Sort block items according to `prioritizedInserterBlocks`.
let aIndex = prioritizedInserterBlocks.indexOf( aName );
Expand Down

0 comments on commit cd5ccf9

Please sign in to comment.