Skip to content

Commit

Permalink
fix (icon block): added optional chaining to prevent error (gambitph#…
Browse files Browse the repository at this point in the history
…2546)

Co-authored-by: prconcepcion <[email protected]>
  • Loading branch information
prconcepcion and prconcepcion authored Dec 22, 2022
1 parent d001047 commit a33c6b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/block/accordion/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ addFilter( 'stackable.block-component.icon.after', 'stackable/blockquote', outpu

if ( isAccordionIcon && accordionBlockDetails ) {
const activeVariation = getActiveBlockVariation( accordionBlockDetails.name, accordionBlockDetails.attributes )
const defaultValue = activeVariation.name === 'plus' ? applyFilters( 'stackable.block-component.plus.icon-close' ) : undefined
const defaultValue = activeVariation?.name === 'plus' ? applyFilters( 'stackable.block-component.plus.icon-close' ) : undefined
return (
<>
{ output }
Expand Down Expand Up @@ -236,7 +236,7 @@ addFilter( 'stackable.block-component.icon.default', 'stackable/accordion', star

if ( isAccordionIcon && accordionBlockDetails ) {
const activeVariation = getActiveBlockVariation( accordionBlockDetails.name, accordionBlockDetails.attributes )
return ( activeVariation.name === 'plus' )
return ( activeVariation?.name === 'plus' )
? applyFilters( 'stackable.block-component.plus.icon-open' ) : defaultIcon
}
return starIcon
Expand Down

0 comments on commit a33c6b6

Please sign in to comment.