Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Aug 1, 2023
1 parent 7c5f794 commit 1520739
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions packages/block-editor/src/hooks/auto-inserting-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,10 @@ function AutoInsertingBlocksControl( props ) {
return getBlockTypes();
}, [] );

const autoInsertedBlocksForCurrentBlock = blocks.reduce(
( autoInsertedBlocks, block ) => {
if ( ! block.autoInsert ) {
return autoInsertedBlocks;
}

const name = Object.keys( block.autoInsert ).find(
( n ) => n === props.blockName
);
if ( name !== undefined ) {
autoInsertedBlocks.push( block );
}
return autoInsertedBlocks;
},
[]
const autoInsertedBlocksForCurrentBlock = blocks.filter(
( block ) =>
block.autoInsert &&
Object.keys( block.autoInsert ).includes( props.blockName )
);

return (
Expand Down

0 comments on commit 1520739

Please sign in to comment.