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 50729710c5
commit 85ff73cb26
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"
}
})