react-hook-form 7.17.3 → 7.17.4

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.
package/dist/index.esm.js CHANGED
@@ -101,7 +101,7 @@ var shouldRenderFormState = (formStateData, _proxyFormState, isRoot) => {
101
101
  (!isRoot || VALIDATION_MODE.all)));
102
102
  };
103
103
 
104
- var convertToArrayPayload = (value) => Array.isArray(value) ? value : [value];
104
+ var convertToArrayPayload = (value) => (Array.isArray(value) ? value : [value]);
105
105
 
106
106
  var shouldSubscribeByName = (name, signalName) => !name ||
107
107
  !signalName ||
@@ -1600,7 +1600,11 @@ function createFormControl(props = {}) {
1600
1600
  }
1601
1601
  }
1602
1602
  }
1603
- _formValues = props.shouldUnregister ? {} : cloneUpdatedValues;
1603
+ _formValues = props.shouldUnregister
1604
+ ? keepStateOptions.keepDefaultValues
1605
+ ? _defaultValues
1606
+ : {}
1607
+ : cloneUpdatedValues;
1604
1608
  _fields = {};
1605
1609
  _subjects.control.next({
1606
1610
  values: hasUpdatedFormValues ? cloneUpdatedValues : _defaultValues,
@@ -1649,8 +1653,8 @@ function createFormControl(props = {}) {
1649
1653
  _stateFlags.watch = !!props.shouldUnregister;
1650
1654
  };
1651
1655
  const setFocus = (name) => {
1652
- const ref = get(_fields, name)._f;
1653
- (ref.focus || ref.refs[0]).focus();
1656
+ const field = get(_fields, name)._f;
1657
+ (field.ref.focus ? field.ref : field.refs[0]).focus();
1654
1658
  };
1655
1659
  return {
1656
1660
  control: {