From cd5ccf9f12fb521a3929e30077d3a7057ae60ab4 Mon Sep 17 00:00:00 2001 From: Jerry Jones Date: Tue, 9 May 2023 13:56:29 -0500 Subject: [PATCH] Don't bother sorting if there are no proitizedInnerBlocks --- packages/block-editor/src/components/list-view/appender.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/block-editor/src/components/list-view/appender.js b/packages/block-editor/src/components/list-view/appender.js index 9819e37920d631..db3f617f1a6de0 100644 --- a/packages/block-editor/src/components/list-view/appender.js +++ b/packages/block-editor/src/components/list-view/appender.js @@ -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 );