react-hook-form 7.61.0 → 7.62.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.
@@ -40,7 +40,7 @@ function cloneObject(data) {
40
40
  }
41
41
  else if (!(isWeb && (data instanceof Blob || isFileListInstance)) &&
42
42
  (isArray || isObject(data))) {
43
- copy = isArray ? [] : {};
43
+ copy = isArray ? [] : Object.create(Object.getPrototypeOf(data));
44
44
  if (!isArray && !isPlainObject(data)) {
45
45
  copy = data;
46
46
  }
@@ -1717,8 +1717,10 @@ function createFormControl(props = {}) {
1717
1717
  const watched = isWatched(name, _names, isBlurEvent);
1718
1718
  set(_formValues, name, fieldValue);
1719
1719
  if (isBlurEvent) {
1720
- field._f.onBlur && field._f.onBlur(event);
1721
- delayErrorCallback && delayErrorCallback(0);
1720
+ if (!target || !target.readOnly) {
1721
+ field._f.onBlur && field._f.onBlur(event);
1722
+ delayErrorCallback && delayErrorCallback(0);
1723
+ }
1722
1724
  }
1723
1725
  else if (field._f.onChange) {
1724
1726
  field._f.onChange(event);
@@ -2213,6 +2215,7 @@ function createFormControl(props = {}) {
2213
2215
  ? _formState.isSubmitSuccessful
2214
2216
  : false,
2215
2217
  isSubmitting: false,
2218
+ defaultValues: _defaultValues,
2216
2219
  });
2217
2220
  };
2218
2221
  const reset = (formValues, keepStateOptions) => _reset(isFunction(formValues)