Skip to content

Commit

Permalink
Review tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed May 29, 2020
1 parent f041a88 commit 120daec
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
6 changes: 2 additions & 4 deletions packages/block-editor/src/components/inserter/block-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,13 @@ export function InserterBlockList( {
rootClientId,
onInsert
);
const { rootChildBlocks } = useSelect(
const rootChildBlocks = useSelect(
( select ) => {
const { getBlockName } = select( 'core/block-editor' );
const { getChildBlockNames } = select( 'core/blocks' );
const rootBlockName = getBlockName( rootClientId );

return {
rootChildBlocks: getChildBlockNames( rootBlockName ),
};
return getChildBlockNames( rootBlockName );
},
[ rootClientId ]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ const useBlockTypesState = ( rootClientId, onInsert ) => {
}
}, [] );

const onSelectItem = ( item ) => {
const { name, initialAttributes, innerBlocks } = item;
const onSelectItem = ( { name, initialAttributes, innerBlocks } ) => {
const insertedBlock = createBlock(
name,
initialAttributes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import { speak } from '@wordpress/a11y';
/**
* @typedef WPInserterConfig
*
* @property {string=} rootClientId Inserter Root Client ID.
* @property {string=} rootClientId Inserter Root Client ID.
* @property {string=} clientId Inserter Client ID.
* @property {boolean} isAppender Whether the inserter is an appender or not.
* @property {boolean} selectBlockOnInsert Whether the block should be selected on insert.
* @property {boolean} isAppender Whether the inserter is an appender or not.
* @property {boolean} selectBlockOnInsert Whether the block should be selected on insert.
*/

/**
Expand Down Expand Up @@ -50,7 +50,7 @@ function useInsertionPoint( {
if ( ! destRootClientId && ! clientId && ! isAppender ) {
const end = _getBlockSelectionEnd();
if ( end ) {
destRootClientId = getBlockRootClientId( end ) || undefined;
destRootClientId = getBlockRootClientId( end );
}
}
return {
Expand Down

0 comments on commit 120daec

Please sign in to comment.