react-hook-form 7.71.1 → 7.71.2
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/__tests__/utils/update.test.d.ts +2 -0
- package/dist/__tests__/utils/update.test.d.ts.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.mjs +18 -5
- 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/logic/createFormControl.d.ts.map +1 -1
- package/dist/react-server.esm.mjs +18 -5
- package/dist/react-server.esm.mjs.map +1 -1
- package/dist/types/form.d.ts +2 -2
- package/dist/types/form.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFormControl.d.ts","sourceRoot":"","sources":["../../src/logic/createFormControl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAaV,WAAW,EAiBX,YAAY,EAIZ,aAAa,EAUd,MAAM,UAAU,CAAC;AAqDlB,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,
|
|
1
|
+
{"version":3,"file":"createFormControl.d.ts","sourceRoot":"","sources":["../../src/logic/createFormControl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAaV,WAAW,EAiBX,YAAY,EAIZ,aAAa,EAUd,MAAM,UAAU,CAAC;AAqDlB,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,CAk/CA"}
|
|
@@ -1360,11 +1360,24 @@ function createFormControl(props = {}) {
|
|
|
1360
1360
|
isTouched: !!get((formState || _formState).touchedFields, name),
|
|
1361
1361
|
});
|
|
1362
1362
|
const clearErrors = (name) => {
|
|
1363
|
-
name
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1363
|
+
const names = name ? convertToArrayPayload(name) : undefined;
|
|
1364
|
+
names === null || names === void 0 ? void 0 : names.forEach((inputName) => unset(_formState.errors, inputName));
|
|
1365
|
+
if (names) {
|
|
1366
|
+
// Emit for each cleared field with the field name so that
|
|
1367
|
+
// shouldSubscribeByName can filter and avoid broad re-renders
|
|
1368
|
+
names.forEach((inputName) => {
|
|
1369
|
+
_subjects.state.next({
|
|
1370
|
+
name: inputName,
|
|
1371
|
+
errors: _formState.errors,
|
|
1372
|
+
});
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
else {
|
|
1376
|
+
// Clear all errors - emit without name to notify all subscribers
|
|
1377
|
+
_subjects.state.next({
|
|
1378
|
+
errors: {},
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1368
1381
|
};
|
|
1369
1382
|
const setError = (name, error, options) => {
|
|
1370
1383
|
const ref = (get(_fields, name, { _f: {} })._f || {}).ref;
|