Skip to content

Commit fad73f1

Browse files
committed
add optional chaining
1 parent 2c2e380 commit fad73f1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/block/design-library/edit.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,17 +169,17 @@ const Edit = props => {
169169
// For blocks with variations, do not remove the uniqueId
170170
// since that will prompt the layout picker to show.
171171
const hasVariations = !! getBlockType( blockName ) && getBlockVariations( blockName ).length > 0
172-
if ( ! hasVariations && block.attributes.uniqueId ) {
172+
if ( ! hasVariations && block.attributes?.uniqueId ) {
173173
delete block.attributes.uniqueId
174174
}
175175

176-
const customAttributes = block.attributes.customAttributes
176+
const customAttributes = block.attributes?.customAttributes
177177

178178
const isDesignLibraryDevMode = devMode && localStorage.getItem( 'stk__design_library__dev_mode' ) === '1'
179179
if ( ! isDesignLibraryDevMode ) {
180180
const indexToDelete = customAttributes?.findIndex( attribute => attribute[ 0 ] === 'stk-design-library__bg-target' )
181181
if ( customAttributes && indexToDelete !== -1 ) {
182-
block.attributes.customAttributes.splice( indexToDelete, 1 )
182+
block.attributes?.customAttributes.splice( indexToDelete, 1 )
183183
}
184184
}
185185

0 commit comments

Comments
 (0)