Skip to content

Commit

Permalink
make templateAreas optional
Browse files Browse the repository at this point in the history
  • Loading branch information
gigitux committed Nov 25, 2024
1 parent 1f47713 commit 745b904
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/editor/src/utils/get-template-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) => {
Expand All @@ -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 {
Expand Down

0 comments on commit 745b904

Please sign in to comment.