react-hook-form 7.58.0 → 7.59.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.
@@ -1 +1 @@
1
- {"version":3,"file":"createFormControl.d.ts","sourceRoot":"","sources":["../../src/logic/createFormControl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAaV,WAAW,EAgBX,YAAY,EAIZ,aAAa,EAUd,MAAM,UAAU,CAAC;AAoDlB,wBAAgB,iBAAiB,CAC/B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,QAAQ,GAAG,GAAG,EACd,kBAAkB,GAAG,YAAY,EAEjC,KAAK,GAAE,YAAY,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAM,GACnE,IAAI,CACL,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,EACzD,WAAW,CACZ,GAAG;IACF,WAAW,EAAE,IAAI,CACf,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,EACzD,WAAW,CACZ,CAAC;CACH,CAg6CA"}
1
+ {"version":3,"file":"createFormControl.d.ts","sourceRoot":"","sources":["../../src/logic/createFormControl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAaV,WAAW,EAgBX,YAAY,EAIZ,aAAa,EAUd,MAAM,UAAU,CAAC;AAoDlB,wBAAgB,iBAAiB,CAC/B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,QAAQ,GAAG,GAAG,EACd,kBAAkB,GAAG,YAAY,EAEjC,KAAK,GAAE,YAAY,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAM,GACnE,IAAI,CACL,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,EACzD,WAAW,CACZ,GAAG;IACF,WAAW,EAAE,IAAI,CACf,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,EACzD,WAAW,CACZ,CAAC;CACH,CAs6CA"}
@@ -1 +1 @@
1
- {"version":3,"file":"generateId.d.ts","sourceRoot":"","sources":["../../src/logic/generateId.ts"],"names":[],"mappings":";AAEA,wBAaE"}
1
+ {"version":3,"file":"generateId.d.ts","sourceRoot":"","sources":["../../src/logic/generateId.ts"],"names":[],"mappings":";AAAA,wBAaE"}
@@ -111,7 +111,7 @@ var createSubject = () => {
111
111
 
112
112
  var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
113
113
 
114
- function deepEqual(object1, object2) {
114
+ function deepEqual(object1, object2, _internal_visited = new WeakSet()) {
115
115
  if (isPrimitive(object1) || isPrimitive(object2)) {
116
116
  return object1 === object2;
117
117
  }
@@ -123,6 +123,11 @@ function deepEqual(object1, object2) {
123
123
  if (keys1.length !== keys2.length) {
124
124
  return false;
125
125
  }
126
+ if (_internal_visited.has(object1) || _internal_visited.has(object2)) {
127
+ return true;
128
+ }
129
+ _internal_visited.add(object1);
130
+ _internal_visited.add(object2);
126
131
  for (const key of keys1) {
127
132
  const val1 = object1[key];
128
133
  if (!keys2.includes(key)) {
@@ -133,7 +138,7 @@ function deepEqual(object1, object2) {
133
138
  if ((isDateObject(val1) && isDateObject(val2)) ||
134
139
  (isObject(val1) && isObject(val2)) ||
135
140
  (Array.isArray(val1) && Array.isArray(val2))
136
- ? !deepEqual(val1, val2)
141
+ ? !deepEqual(val1, val2, _internal_visited)
137
142
  : val1 !== val2) {
138
143
  return false;
139
144
  }
@@ -1523,14 +1528,14 @@ function createFormControl(props = {}) {
1523
1528
  if (_options.resolver) {
1524
1529
  const { errors, values } = await _runSchema();
1525
1530
  _formState.errors = errors;
1526
- fieldValues = values;
1531
+ fieldValues = cloneObject(values);
1527
1532
  }
1528
1533
  else {
1529
1534
  await executeBuiltInValidation(_fields);
1530
1535
  }
1531
1536
  if (_names.disabled.size) {
1532
1537
  for (const name of _names.disabled) {
1533
- set(fieldValues, name, undefined);
1538
+ unset(fieldValues, name);
1534
1539
  }
1535
1540
  }
1536
1541
  unset(_formState.errors, 'root');
@@ -1627,7 +1632,11 @@ function createFormControl(props = {}) {
1627
1632
  }
1628
1633
  }
1629
1634
  for (const fieldName of _names.mount) {
1630
- setValue(fieldName, get(values, fieldName));
1635
+ const value = get(values, fieldName, get(_defaultValues, fieldName));
1636
+ if (!isUndefined(value)) {
1637
+ set(values, fieldName, value);
1638
+ setValue(fieldName, get(values, fieldName));
1639
+ }
1631
1640
  }
1632
1641
  }
1633
1642
  _formValues = cloneObject(values);