issue: isDirty is not properly updated when defaultValue is passed to useControlled #11494
Replies: 4 comments
-
The sandbox is not found. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick response. I didn't notice they were draft and private. I've updated the permissions and should work now! |
Beta Was this translation helpful? Give feedback.
-
I feel like it's the same story as #11402 |
Beta Was this translation helpful? Give feedback.
-
I guess the point that makes me believe they both should work the same is this section in the docs: https://react-hook-form.com/docs/usecontroller ![]() |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Version Number
7.50.0
Codesandbox/Expo snack
https://codesandbox.io/p/sandbox/blazing-dew-smqxvw
Steps to reproduce
watch()
at the bottom of the page's'
isDirty
value:fieldState.isDirty
is trueforState.isDirty
is true's'
)isDirty
values:fieldState.isDirty
is still trueforState.isDirty
is still trueExpected behaviour
I'd have expected the
isDirty
value to return back to false because the input value was returned to its original valueWhat browsers are you seeing the problem on?
Firefox, Chrome, Safari, Edge
Additional information
it works as expected if I added
defaultValues
touseForm
state, and remove it fromuseControlled
(see modified codesanbox) and repeat all the stepsCode of Conduct
Beta Was this translation helpful? Give feedback.
All reactions