Repository: react-hook-form/react-hook-form (2025-07-27T04:16:29Z)

Issue:
issue: `useFormState().defaultValues` does not update after `reset()` with new default values
### Version Number

7.61.1

### Codesandbox/Expo snack

https://codesandbox.io/p/sandbox/peaceful-scooby-fn8xwg

### Steps to reproduce

- Open [this sandbox](https://codesandbox.io/p/sandbox/peaceful-scooby-fn8xwg)
- Click the "Reset default values" button several times
- Observe the console

<img width="1373" height="950" alt="Image" src="https://github.com/user-attachments/assets/87f86cf7-6524-4d04-975c-b82fa3c3ddf9" />

## Expected:

`formState.defaultValues` should reflect the updated values passed to `useForm` and `form.reset()`.

## Actual:

`formState.defaultValues` remains stuck at the initial value, even after both `reset()` is called and the `defaultValues` prop is updated.

### Expected behaviour

When using useFormState().defaultValues, I expect this value to stay in sync with the values passed to useForm and the ones provided to reset(). Currently, it only reflects the initial defaultValues.

This makes it difficult to rely on formState.defaultValues for comparing current values to defaults or implementing reset behavior for dynamic forms.

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct


Discussion:
@snelsi 
This seems odd. I’d like to work on it.
Good catch, good fix. We were debugging this on Friday. 👍 



Patch:
diff --git a/src/logic/createFormControl.ts b/src/logic/createFormControl.ts
index 8a4ca25e2e7..fb60c6cd537 100644
--- a/src/logic/createFormControl.ts
+++ b/src/logic/createFormControl.ts
@@ -1438,6 +1438,7 @@ export function createFormControl<
         ? _formState.isSubmitSuccessful
         : false,
       isSubmitting: false,
+      defaultValues: _defaultValues as FormState<TFieldValues>['defaultValues'],
     });
   };
 


Test patch:
diff --git a/src/__tests__/useForm.test.tsx b/src/__tests__/useForm.test.tsx
index 2420377f08c..0d5969818d8 100644
--- a/src/__tests__/useForm.test.tsx
+++ b/src/__tests__/useForm.test.tsx
@@ -26,7 +26,13 @@ import type {
 import isFunction from '../utils/isFunction';
 import noop from '../utils/noop';
 import sleep from '../utils/sleep';
-import { Controller, createFormControl, useFieldArray, useForm } from '../';
+import {
+  Controller,
+  createFormControl,
+  useFieldArray,
+  useForm,
+  useFormState,
+} from '../';
 
 jest.useFakeTimers();
 
@@ -2724,4 +2730,49 @@ describe('useForm', () => {
       expect(input.value).toBe('abc');
     });
   });
+
+  describe('When using defaultValues', () => {
+    function App() {
+      type FormValues = {
+        firstName: string;
+      };
+
+      const [defaults, setDefaults] = React.useState<FormValues>({
+        firstName: '1',
+      });
+
+      const { control, formState, reset, register } = useForm<FormValues>({
+        defaultValues: defaults,
+      });
+
+      const { defaultValues: stateDefaults } = useFormState({ control });
+
+      const handleClick = () => {
+        const next = { firstName: String(Number(defaults.firstName) + 1) };
+        setDefaults(next);
+        reset(next);
+      };
+
+      return (
+        <div>
+          <input {...register('firstName')} />
+          <button onClick={handleClick}>reset</button>
+          <span data-testid="react">{defaults.firstName}</span>
+          <span data-testid="form">{formState.defaultValues?.firstName}</span>
+          <span data-testid="state">{stateDefaults?.firstName}</span>
+        </div>
+      );
+    }
+    it('formState.defaultValues and useFormState().defaultValues should be equal after reset', () => {
+      render(<App />);
+
+      fireEvent.click(screen.getByText('reset'));
+      fireEvent.click(screen.getByText('reset'));
+      fireEvent.click(screen.getByText('reset'));
+
+      const reactValue = screen.getByTestId('react').textContent;
+      expect(screen.getByTestId('form').textContent).toBe(reactValue);
+      expect(screen.getByTestId('state').textContent).toBe(reactValue);
+    });
+  });
 });