From 745b90449d5d4a650bd96a9aabd84c71baadc8fd Mon Sep 17 00:00:00 2001 From: Luigi Teschio Date: Mon, 25 Nov 2024 16:58:42 +0100 Subject: [PATCH] make templateAreas optional --- packages/editor/src/utils/get-template-info.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/editor/src/utils/get-template-info.js b/packages/editor/src/utils/get-template-info.js index a6bc4c2d8dc461..bc84c06c9399d4 100644 --- a/packages/editor/src/utils/get-template-info.js +++ b/packages/editor/src/utils/get-template-info.js @@ -12,7 +12,7 @@ const EMPTY_OBJECT = {}; * Helper function to retrieve the corresponding template info for a given template. * @param {Object} params * @param {Array} params.templateTypes - * @param {Array} params.templateAreas + * @param {Array} [params.templateAreas] * @param {Object} params.template */ export const getTemplateInfo = ( params ) => { @@ -32,13 +32,13 @@ export const getTemplateInfo = ( params ) => { const templateDescription = typeof description === 'string' ? description : description?.raw; - const templateAreasWithIcon = templateAreas.map( ( item ) => ( { + const templateAreasWithIcon = templateAreas?.map( ( item ) => ( { ...item, icon: getTemplatePartIcon( item.icon ), } ) ); const templateIcon = - templateAreasWithIcon.find( ( item ) => area === item.area )?.icon || + templateAreasWithIcon?.find( ( item ) => area === item.area )?.icon || layout; return {