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.
@@ -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(props.disabled)) {
2152
- _subjects.state.next({ disabled: props.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);