@@ -157,12 +157,16 @@ const ADDITIONAL_ATTRIBUTES = {
157157
158158const INNER_BLOCK_CALLBACKS = {
159159 'stackable/team-member' : innerBlocks => {
160- innerBlocks [ 0 ] . attributes . imageExternalUrl = `${ srcUrl } /${ profile } `
160+ if ( innerBlocks ?. [ 0 ] ?. attributes ) {
161+ innerBlocks [ 0 ] . attributes . imageExternalUrl = `${ srcUrl } /${ profile } `
162+ }
161163
162164 return innerBlocks
163165 } ,
164166 'stackable/testimonial' : innerBlocks => {
165- innerBlocks [ 1 ] . attributes . imageExternalUrl = `${ srcUrl } /${ profile } `
167+ if ( innerBlocks ?. [ 1 ] ?. attributes ) {
168+ innerBlocks [ 1 ] . attributes . imageExternalUrl = `${ srcUrl } /${ profile } `
169+ }
166170
167171 return innerBlocks
168172 } ,
@@ -199,7 +203,8 @@ export const DefaultOutlineButton = ( {
199203}
200204
201205const getGeneratedCss = ( blocks , generateForInnerBlocks = false ) => {
202- return blocks . map ( block => {
206+ const list = Array . isArray ( blocks ) ? blocks : [ ]
207+ return list . map ( block => {
203208 if ( ! block . attributes . uniqueId ) {
204209 block . attributes . uniqueId = createUniqueClass ( block . clientId )
205210 }
@@ -220,7 +225,7 @@ const getGeneratedCss = ( blocks, generateForInnerBlocks = false ) => {
220225
221226 block . attributes . generatedCss = saveCss
222227
223- if ( generateForInnerBlocks ) {
228+ if ( generateForInnerBlocks && Array . isArray ( block . innerBlocks ) ) {
224229 block . innerBlocks = getGeneratedCss ( block . innerBlocks , generateForInnerBlocks )
225230 }
226231
@@ -290,10 +295,12 @@ export const RenderBlock = props => {
290295 } = getSerializedBlock ( propsToPass )
291296
292297 return (
293- < RawHTML >
294- { cleanSerializedBlock ( serialized , SERIALIZE_CALLBACKS [ blockName ] , attributes ) }
295- { `<p>${ name } </p>` }
296- </ RawHTML >
298+ < >
299+ < RawHTML >
300+ { cleanSerializedBlock ( serialized , SERIALIZE_CALLBACKS [ blockName ] , attributes ) }
301+ </ RawHTML >
302+ < p > { name } </ p >
303+ </ >
297304 )
298305}
299306
0 commit comments