react-hook-form 7.22.4 → 7.22.5

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.
@@ -195,7 +195,9 @@ function useWatch(props) {
195
195
  (isObject(fieldValues) && !objectHasFunction(fieldValues))
196
196
  ? Object.assign({}, fieldValues) : Array.isArray(fieldValues)
197
197
  ? [...fieldValues]
198
- : fieldValues);
198
+ : isUndefined(fieldValues)
199
+ ? defaultValue
200
+ : fieldValues);
199
201
  }
200
202
  },
201
203
  });
@@ -1318,7 +1320,8 @@ function createFormControl(props = {}) {
1318
1320
  if (field) {
1319
1321
  const fieldReference = field._f;
1320
1322
  if (fieldReference) {
1321
- set(_formValues, name, getFieldValueAs(value, fieldReference));
1323
+ !fieldReference.disabled &&
1324
+ set(_formValues, name, getFieldValueAs(value, fieldReference));
1322
1325
  fieldValue =
1323
1326
  isWeb && isHTMLElement(fieldReference.ref) && isNullOrUndefined(value)
1324
1327
  ? ''
@@ -1581,7 +1584,7 @@ function createFormControl(props = {}) {
1581
1584
  _f: radioOrCheckbox
1582
1585
  ? Object.assign(Object.assign({}, field._f), { refs: [...compact(field._f.refs).filter(live), fieldRef], ref: { type: fieldRef.type, name } }) : Object.assign(Object.assign({}, field._f), { ref: fieldRef }),
1583
1586
  });
1584
- !options.disabled && updateValidAndValue(name, false, fieldRef);
1587
+ updateValidAndValue(name, false, fieldRef);
1585
1588
  }
1586
1589
  else {
1587
1590
  field = get(_fields, name, {});