Checks if maxItemsNumber is undefined.

This commit is contained in:
mateuswetah 2022-06-01 16:36:26 -03:00
parent a02f14ffbc
commit 9ecf899a86
2 changed files with 4 additions and 1 deletions

View File

@ -8,6 +8,9 @@ export default [
attributes.imageSize = 'tainacan-medium';
else
attributes.imageSize = 'tainacan-medium-full';
if ( isNaN(attributes.maxItemsNumber) )
attributes.maxItemsNumber = 12;
return attributes;
},

View File

@ -281,7 +281,7 @@ export default function({ attributes, setAttributes, className, isSelected, clie
if (maxItemsNumber != undefined && maxItemsNumber > 0)
queryObject.perpage = maxItemsNumber;
else if (queryObject.perpage != undefined && queryObject.perpage > 0)
setAttributes({ maxItemsNumber: queryObject.perpage });
setAttributes({ maxItemsNumber: Number(queryObject.perpage) });
else {
queryObject.perpage = 12;
setAttributes({ maxItemsNumber: 12 });