react-hook-form 7.52.1 → 7.52.2

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.
@@ -407,6 +407,7 @@ function useController(props) {
407
407
  const formState = useFormState({
408
408
  control,
409
409
  name,
410
+ exact: true,
410
411
  });
411
412
  const _registerProps = React.useRef(control.register(name, {
412
413
  ...props.rules,
@@ -468,7 +469,7 @@ function useController(props) {
468
469
  },
469
470
  type: EVENTS.BLUR,
470
471
  }), [name, control]),
471
- ref: (elm) => {
472
+ ref: React.useCallback((elm) => {
472
473
  const field = get(control._fields, name);
473
474
  if (field && elm) {
474
475
  field._f.ref = {
@@ -478,7 +479,7 @@ function useController(props) {
478
479
  reportValidity: () => elm.reportValidity(),
479
480
  };
480
481
  }
481
- },
482
+ }, [control._fields, name]),
482
483
  },
483
484
  formState,
484
485
  fieldState: Object.defineProperties({}, {
@@ -1791,7 +1792,7 @@ function createFormControl(props = {}) {
1791
1792
  : set(_formState.errors, _f.name, fieldError[_f.name])
1792
1793
  : unset(_formState.errors, _f.name));
1793
1794
  }
1794
- fieldValue &&
1795
+ !isEmptyObject(fieldValue) &&
1795
1796
  (await executeBuiltInValidation(fieldValue, shouldOnlyCheckValid, context));
1796
1797
  }
1797
1798
  }