react-hook-form 7.24.1 → 7.24.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.
@@ -242,11 +242,11 @@ function useController(props) {
242
242
  updateMounted(name, true);
243
243
  return () => {
244
244
  const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
245
- isArrayField
245
+ (isArrayField
246
246
  ? _shouldUnregisterField && !control._stateFlags.action
247
- : _shouldUnregisterField
248
- ? control.unregister(name)
249
- : updateMounted(name, false);
247
+ : _shouldUnregisterField)
248
+ ? control.unregister(name)
249
+ : updateMounted(name, false);
250
250
  };
251
251
  }, [name, control, isArrayField, shouldUnregister]);
252
252
  return {
@@ -285,8 +285,8 @@ function useController(props) {
285
285
  formState,
286
286
  fieldState: {
287
287
  invalid: !!get(formState.errors, name),
288
- isDirty: get(formState.dirtyFields, name),
289
- isTouched: get(formState.touchedFields, name),
288
+ isDirty: !!get(formState.dirtyFields, name),
289
+ isTouched: !!get(formState.touchedFields, name),
290
290
  error: get(formState.errors, name),
291
291
  },
292
292
  };
@@ -1505,8 +1505,8 @@ function createFormControl(props = {}) {
1505
1505
  };
1506
1506
  const _getFieldState = (name, formState) => ({
1507
1507
  invalid: !!get((formState || _formState).errors, name),
1508
- isDirty: get((formState || _formState).dirtyFields, name),
1509
- isTouched: get((formState || _formState).touchedFields, name),
1508
+ isDirty: !!get((formState || _formState).dirtyFields, name),
1509
+ isTouched: !!get((formState || _formState).touchedFields, name),
1510
1510
  error: get((formState || _formState).errors, name),
1511
1511
  });
1512
1512
  const clearErrors = (name) => {