Skip to content

Commit 31e9ca3

Browse files
committed
fix(renderer): Ignore empty values in length validators
1 parent 7f7884b commit 31e9ca3

File tree

1 file changed

+5
-1
lines changed
  • packages/react-form-renderer/src/validators

1 file changed

+5
-1
lines changed

packages/react-form-renderer/src/validators/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ export const length = memoize(({
2121
equal = selectNum(equal, is);
2222
min = selectNum(min, minimum);
2323
max = selectNum(max, maximum);
24-
return prepare ((value = []) => {
24+
return prepare ((value) => {
25+
if (!value) {
26+
return;
27+
}
28+
2529
if (equal !== null && value.length !== equal) {
2630
const msg = prepareMsg(message, 'wrongLength', { count: equal }).defaultMessage;
2731
return typeof msg === 'string' ? msg : msg(equal);

0 commit comments

Comments
 (0)