react-hook-form 7.24.2 → 7.25.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.
@@ -283,12 +283,7 @@ function useController(props) {
283
283
  }, [name, control]),
284
284
  },
285
285
  formState,
286
- fieldState: {
287
- invalid: !!get(formState.errors, name),
288
- isDirty: !!get(formState.dirtyFields, name),
289
- isTouched: !!get(formState.touchedFields, name),
290
- error: get(formState.errors, name),
291
- },
286
+ fieldState: control.getFieldState(name, formState),
292
287
  };
293
288
  }
294
289
 
@@ -1503,7 +1498,7 @@ function createFormControl(props = {}) {
1503
1498
  ? get(values, fieldNames)
1504
1499
  : fieldNames.map((name) => get(values, name));
1505
1500
  };
1506
- const _getFieldState = (name, formState) => ({
1501
+ const getFieldState = (name, formState) => ({
1507
1502
  invalid: !!get((formState || _formState).errors, name),
1508
1503
  isDirty: !!get((formState || _formState).dirtyFields, name),
1509
1504
  isTouched: !!get((formState || _formState).touchedFields, name),
@@ -1773,6 +1768,7 @@ function createFormControl(props = {}) {
1773
1768
  control: {
1774
1769
  register,
1775
1770
  unregister,
1771
+ getFieldState,
1776
1772
  _executeSchema,
1777
1773
  _getWatch,
1778
1774
  _getDirty,
@@ -1837,7 +1833,7 @@ function createFormControl(props = {}) {
1837
1833
  unregister,
1838
1834
  setError,
1839
1835
  setFocus,
1840
- _getFieldState,
1836
+ getFieldState,
1841
1837
  };
1842
1838
  }
1843
1839