react-hook-form icon indicating copy to clipboard operation
react-hook-form copied to clipboard

issue: resetField set option defaultValue not update form default value for that field

Open duyvinh229148 opened this issue 1 year ago • 0 comments

Version Number

^7.52.2

Codesandbox/Expo snack

lazy, I just want you to notify about the bug

Steps to reproduce

I tried reset({ ...getValues(), mySingleFormField: 'newDefaultValue' }), which work But when I try resetField('mySingleFormField', {defaultValue: 'newDefaultValue'}), it's not work. I can tell by console.log(defaultValues) from formState: {defaultValues}

Expected behaviour

resetField set 'newDefaultValue' as current field value AND update form's defaultValues to use 'newDefaultValue', so that next time when I call reset(), mySingleFormField will be reset back to 'newDefaultValue'

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

duyvinh229148 avatar Aug 27 '24 22:08 duyvinh229148