Skip to content

Commit

Permalink
Block Editor: Ensure that blockType is defined when accessing `apiV…
Browse files Browse the repository at this point in the history
…ersion` (#34346)
  • Loading branch information
gziolo authored Sep 1, 2021
1 parent 3b3339d commit 0114164
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/block-editor/src/components/block-list/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ function BlockListBlock( {

const blockType = getBlockType( name );
const lightBlockWrapper =
blockType.apiVersion > 1 ||
blockType?.apiVersion > 1 ||
hasBlockSupport( blockType, 'lightBlockWrapper', false );

// Determine whether the block has props to apply to the wrapper.
if ( blockType.getEditWrapperProps ) {
if ( blockType?.getEditWrapperProps ) {
wrapperProps = mergeWrapperProps(
wrapperProps,
blockType.getEditWrapperProps( attributes )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function useBlockCustomClassName( clientId ) {

const blockType = getBlockType( getBlockName( clientId ) );
const hasLightBlockWrapper =
blockType.apiVersion > 1 ||
blockType?.apiVersion > 1 ||
hasBlockSupport( blockType, 'lightBlockWrapper', false );

if ( ! hasLightBlockWrapper ) {
Expand Down

0 comments on commit 0114164

Please sign in to comment.