Merge pull request #20180 from strapi/fix/issue-19660

fix: content could be undefined
This commit is contained in:
Alexandre BODIN 2024-04-23 16:00:18 +02:00 committed by GitHub
commit 6ad256cd15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -95,7 +95,7 @@ const hasContent = (
// Repeatable fields show the ID as fallback, in case the mainField
// doesn't have any content
if (fieldSchema?.repeatable || !mainField) {
return content.length > 0;
return content && Array.isArray(content) && content.length > 0;
}
const value = content?.[mainField.name];
@ -130,7 +130,7 @@ const hasContent = (
return content?.count > 0;
}
/*
/*
Biginteger fields need to be treated as strings, as `isNumber`
doesn't deal with them.
*/