react-hook-form 7.34.0-next.0 → 7.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -659,7 +659,7 @@ var validateField = async (field, inputValue, validateAllFieldCriteria, shouldUs
659
659
  };
660
660
  };
661
661
  if (isFieldArray
662
- ? Array.isArray(inputValue) && !inputValue.length
662
+ ? !Array.isArray(inputValue) || !inputValue.length
663
663
  : required &&
664
664
  ((!isRadioOrCheckbox && (isEmpty || isNullOrUndefined(inputValue))) ||
665
665
  (isBoolean(inputValue) && !inputValue) ||
@@ -1431,7 +1431,7 @@ function createFormControl(props = {}) {
1431
1431
  if (_proxyFormState.isValid) {
1432
1432
  isValid = _options.resolver
1433
1433
  ? isEmptyObject((await _executeSchema()).errors)
1434
- : await executeBuildInValidation(_fields, true);
1434
+ : await executeBuiltInValidation(_fields, true);
1435
1435
  if (!shouldSkipRender && isValid !== _formState.isValid) {
1436
1436
  _formState.isValid = isValid;
1437
1437
  _subjects.state.next({
@@ -1582,7 +1582,7 @@ function createFormControl(props = {}) {
1582
1582
  }
1583
1583
  return errors;
1584
1584
  };
1585
- const executeBuildInValidation = async (fields, shouldOnlyCheckValid, context = {
1585
+ const executeBuiltInValidation = async (fields, shouldOnlyCheckValid, context = {
1586
1586
  valid: true,
1587
1587
  }) => {
1588
1588
  for (const name in fields) {
@@ -1606,7 +1606,7 @@ function createFormControl(props = {}) {
1606
1606
  : unset(_formState.errors, _f.name));
1607
1607
  }
1608
1608
  fieldValue &&
1609
- (await executeBuildInValidation(fieldValue, shouldOnlyCheckValid, context));
1609
+ (await executeBuiltInValidation(fieldValue, shouldOnlyCheckValid, context));
1610
1610
  }
1611
1611
  }
1612
1612
  return context.valid;
@@ -1801,12 +1801,12 @@ function createFormControl(props = {}) {
1801
1801
  else if (name) {
1802
1802
  validationResult = (await Promise.all(fieldNames.map(async (fieldName) => {
1803
1803
  const field = get(_fields, fieldName);
1804
- return await executeBuildInValidation(field && field._f ? { [fieldName]: field } : field);
1804
+ return await executeBuiltInValidation(field && field._f ? { [fieldName]: field } : field);
1805
1805
  }))).every(Boolean);
1806
1806
  !(!validationResult && !_formState.isValid) && _updateValid();
1807
1807
  }
1808
1808
  else {
1809
- validationResult = isValid = await executeBuildInValidation(_fields);
1809
+ validationResult = isValid = await executeBuiltInValidation(_fields);
1810
1810
  }
1811
1811
  _subjects.state.next({
1812
1812
  ...(!isString(name) ||
@@ -1986,7 +1986,7 @@ function createFormControl(props = {}) {
1986
1986
  fieldValues = values;
1987
1987
  }
1988
1988
  else {
1989
- await executeBuildInValidation(_fields);
1989
+ await executeBuiltInValidation(_fields);
1990
1990
  }
1991
1991
  if (isEmptyObject(_formState.errors)) {
1992
1992
  _subjects.state.next({
@@ -2069,9 +2069,10 @@ function createFormControl(props = {}) {
2069
2069
  ? field._f.refs[0]
2070
2070
  : field._f.ref;
2071
2071
  try {
2072
- isHTMLElement(fieldReference) &&
2072
+ if (isHTMLElement(fieldReference)) {
2073
2073
  fieldReference.closest('form').reset();
2074
- break;
2074
+ break;
2075
+ }
2075
2076
  }
2076
2077
  catch (_a) { }
2077
2078
  }