Do not validate if multi-select options length is 0

This commit is contained in:
Kacper 2022-04-07 12:01:05 +02:00
parent 1f5c97a25a
commit 98a926cfca
1 changed files with 4 additions and 1 deletions

View File

@ -65,7 +65,10 @@ exports.validate = async ({ tableId, row, table }) => {
if (type === FieldTypes.ARRAY && row[fieldName]) {
if (row[fieldName].length) {
row[fieldName].map(val => {
if (!constraints.inclusion.includes(val)) {
if (
!constraints.inclusion.includes(val) &&
constraints.inclusion.length !== 0
) {
errors[fieldName] = "Field not in list"
}
})