@bombillazo/rhf-plus 7.71.1-plus.0 → 7.71.2-plus.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/__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 +31 -29
package/dist/index.esm.mjs
CHANGED
|
@@ -2278,11 +2278,24 @@ function createFormControl(props = {}) {
|
|
|
2278
2278
|
isFocused: (formState || _formState).focusedField === name,
|
|
2279
2279
|
});
|
|
2280
2280
|
const clearErrors = (name) => {
|
|
2281
|
-
name
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2281
|
+
const names = name ? convertToArrayPayload(name) : undefined;
|
|
2282
|
+
names === null || names === void 0 ? void 0 : names.forEach((inputName) => unset(_formState.errors, inputName));
|
|
2283
|
+
if (names) {
|
|
2284
|
+
// Emit for each cleared field with the field name so that
|
|
2285
|
+
// shouldSubscribeByName can filter and avoid broad re-renders
|
|
2286
|
+
names.forEach((inputName) => {
|
|
2287
|
+
_subjects.state.next({
|
|
2288
|
+
name: inputName,
|
|
2289
|
+
errors: _formState.errors,
|
|
2290
|
+
});
|
|
2291
|
+
});
|
|
2292
|
+
}
|
|
2293
|
+
else {
|
|
2294
|
+
// Clear all errors - emit without name to notify all subscribers
|
|
2295
|
+
_subjects.state.next({
|
|
2296
|
+
errors: {},
|
|
2297
|
+
});
|
|
2298
|
+
}
|
|
2286
2299
|
};
|
|
2287
2300
|
const setError = (name, error, options) => {
|
|
2288
2301
|
const ref = (get(_fields, name, { _f: {} })._f || {}).ref;
|