Fixed problem with fieldsArray: field were being added even if the keys check was failing

This commit is contained in:
Alexander Cerutti
2019-07-07 15:41:59 +02:00
parent 09707694ba
commit f37f978e2c

View File

@@ -26,13 +26,13 @@ class FieldsArray extends Array {
return acc;
}
if (acc.some(e => e.key === current.key) || this[poolSymbol].has(current.key)) {
debug(`Field with key "${key}" discarded: fields must be unique in pass scope.`);
if (this[poolSymbol].has(current.key)) {
debug(`Field with key "${current.key}" discarded: fields must be unique in pass scope.`);
} else {
this[poolSymbol].add(current.key);
acc.push(current);
}
this[poolSymbol].add(current.key)
acc.push(current)
return acc;
}, []);