react-hook-form 7.48.1 → 7.48.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/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.mjs +12 -2
- 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/useForm.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.mjs
CHANGED
@@ -2148,8 +2148,8 @@ function createFormControl(props = {}, flushRootRender) {
|
|
2148
2148
|
const _focusError = () => _options.shouldFocusError &&
|
2149
2149
|
iterateFieldsByAction(_fields, _focusInput, _names.mount);
|
2150
2150
|
const _disableForm = (disabled) => {
|
2151
|
-
if (isBoolean(
|
2152
|
-
_subjects.state.next({ disabled
|
2151
|
+
if (isBoolean(disabled)) {
|
2152
|
+
_subjects.state.next({ disabled });
|
2153
2153
|
iterateFieldsByAction(_fields, (ref) => {
|
2154
2154
|
ref.disabled = disabled;
|
2155
2155
|
}, 0, false);
|
@@ -2474,6 +2474,16 @@ function useForm(props = {}) {
|
|
2474
2474
|
},
|
2475
2475
|
});
|
2476
2476
|
React.useEffect(() => control._disableForm(props.disabled), [control, props.disabled]);
|
2477
|
+
React.useEffect(() => {
|
2478
|
+
if (control._proxyFormState.isDirty) {
|
2479
|
+
const isDirty = control._getDirty();
|
2480
|
+
if (isDirty !== formState.isDirty) {
|
2481
|
+
control._subjects.state.next({
|
2482
|
+
isDirty,
|
2483
|
+
});
|
2484
|
+
}
|
2485
|
+
}
|
2486
|
+
}, [control, formState.isDirty]);
|
2477
2487
|
React.useEffect(() => {
|
2478
2488
|
if (props.values && !deepEqual(props.values, _values.current)) {
|
2479
2489
|
control._reset(props.values, control._options.resetOptions);
|