react-hook-form 7.35.0 → 7.36.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.
@@ -2051,7 +2051,7 @@ function createFormControl(props = {}) {
2051
2051
  _subjects.state.next({ ..._formState });
2052
2052
  }
2053
2053
  };
2054
- const reset = (formValues, keepStateOptions = {}) => {
2054
+ const _reset = (formValues, keepStateOptions = {}) => {
2055
2055
  const updatedValues = formValues || _defaultValues;
2056
2056
  const cloneUpdatedValues = cloneObject(updatedValues);
2057
2057
  const values = formValues && !isEmptyObject(formValues)
@@ -2137,6 +2137,9 @@ function createFormControl(props = {}) {
2137
2137
  isSubmitSuccessful: false,
2138
2138
  });
2139
2139
  };
2140
+ const reset = (formValues, keepStateOptions) => _reset(isFunction(formValues)
2141
+ ? formValues(_formValues)
2142
+ : formValues, keepStateOptions);
2140
2143
  const setFocus = (name, options = {}) => {
2141
2144
  const field = get(_fields, name)._f;
2142
2145
  const fieldRef = field.refs ? field.refs[0] : field.ref;