react-hook-form 7.55.0-next.2 → 7.55.0-next.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.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.mjs +22 -15
- package/dist/index.esm.mjs.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/react-server.esm.mjs +11 -12
- package/dist/react-server.esm.mjs.map +1 -1
- package/dist/useController.d.ts.map +1 -1
- package/dist/useWatch.d.ts.map +1 -1
- package/dist/utils/set.d.ts +1 -1
- package/dist/utils/set.d.ts.map +1 -1
- package/package.json +12 -12
@@ -214,7 +214,6 @@ var set = (object, path, value) => {
|
|
214
214
|
object[key] = newValue;
|
215
215
|
object = object[key];
|
216
216
|
}
|
217
|
-
return object;
|
218
217
|
};
|
219
218
|
|
220
219
|
function baseGet(object, updatePath) {
|
@@ -1105,7 +1104,7 @@ function createFormControl(props = {}) {
|
|
1105
1104
|
if (!fieldReference.ref.type) {
|
1106
1105
|
_subjects.state.next({
|
1107
1106
|
name,
|
1108
|
-
values:
|
1107
|
+
values: cloneObject(_formValues),
|
1109
1108
|
});
|
1110
1109
|
}
|
1111
1110
|
}
|
@@ -1136,7 +1135,7 @@ function createFormControl(props = {}) {
|
|
1136
1135
|
if (isFieldArray) {
|
1137
1136
|
_subjects.array.next({
|
1138
1137
|
name,
|
1139
|
-
values:
|
1138
|
+
values: cloneObject(_formValues),
|
1140
1139
|
});
|
1141
1140
|
if ((_proxyFormState.isDirty ||
|
1142
1141
|
_proxyFormState.dirtyFields ||
|
@@ -1158,7 +1157,7 @@ function createFormControl(props = {}) {
|
|
1158
1157
|
isWatched(name, _names) && _subjects.state.next({ ..._formState });
|
1159
1158
|
_subjects.state.next({
|
1160
1159
|
name: _state.mount ? name : undefined,
|
1161
|
-
values:
|
1160
|
+
values: cloneObject(_formValues),
|
1162
1161
|
});
|
1163
1162
|
};
|
1164
1163
|
const onChange = async (event) => {
|
@@ -1200,7 +1199,7 @@ function createFormControl(props = {}) {
|
|
1200
1199
|
_subjects.state.next({
|
1201
1200
|
name,
|
1202
1201
|
type: event.type,
|
1203
|
-
values:
|
1202
|
+
values: cloneObject(_formValues),
|
1204
1203
|
});
|
1205
1204
|
if (shouldSkipValidation) {
|
1206
1205
|
if (_proxyFormState.isValid || _proxySubscribeFormState.isValid) {
|
@@ -1341,7 +1340,7 @@ function createFormControl(props = {}) {
|
|
1341
1340
|
if (shouldSubscribeByName(props.name, formState.name, props.exact) &&
|
1342
1341
|
shouldRenderFormState(formState, props.formState || _proxyFormState, _setFormState, props.reRenderRoot)) {
|
1343
1342
|
props.callback({
|
1344
|
-
values: _formValues,
|
1343
|
+
values: { ..._formValues },
|
1345
1344
|
..._formState,
|
1346
1345
|
...formState,
|
1347
1346
|
});
|
@@ -1377,7 +1376,7 @@ function createFormControl(props = {}) {
|
|
1377
1376
|
unset(_defaultValues, fieldName);
|
1378
1377
|
}
|
1379
1378
|
_subjects.state.next({
|
1380
|
-
values:
|
1379
|
+
values: cloneObject(_formValues),
|
1381
1380
|
});
|
1382
1381
|
_subjects.state.next({
|
1383
1382
|
..._formState,
|
@@ -1503,11 +1502,6 @@ function createFormControl(props = {}) {
|
|
1503
1502
|
e.persist && e.persist();
|
1504
1503
|
}
|
1505
1504
|
let fieldValues = cloneObject(_formValues);
|
1506
|
-
if (_names.disabled.size) {
|
1507
|
-
for (const name of _names.disabled) {
|
1508
|
-
set(fieldValues, name, undefined);
|
1509
|
-
}
|
1510
|
-
}
|
1511
1505
|
_subjects.state.next({
|
1512
1506
|
isSubmitting: true,
|
1513
1507
|
});
|
@@ -1519,6 +1513,11 @@ function createFormControl(props = {}) {
|
|
1519
1513
|
else {
|
1520
1514
|
await executeBuiltInValidation(_fields);
|
1521
1515
|
}
|
1516
|
+
if (_names.disabled.size) {
|
1517
|
+
for (const name of _names.disabled) {
|
1518
|
+
set(fieldValues, name, undefined);
|
1519
|
+
}
|
1520
|
+
}
|
1522
1521
|
unset(_formState.errors, 'root');
|
1523
1522
|
if (isEmptyObject(_formState.errors)) {
|
1524
1523
|
_subjects.state.next({
|