react-hook-form
react-hook-form copied to clipboard
issue: Methods in ref are removed from other inputs in the Controller when one input is unmounted in the input array.
Version Number
7.54.2+
Codesandbox/Expo snack
https://codesandbox.io/p/sandbox/react-hook-form-usefieldarray-rules-forked-d9n5z5
Steps to reproduce
- Append inputs
- Remove last inputs
- First input don't have methods in ref (in control._fields..._f.ref)
Expected behaviour
_f.ref have focus, select methods
{
"_f": {
"ref": {
focus()
select()
...
},
"name": "test.0.lastName",
"mount": true,
"value": "Luo"
}
}
What browsers are you seeing the problem on?
No response
Relevant log output
{
"_f": {
"ref": {
"name": "test.0.lastName"
// lost methods (focus,select,...)
},
"name": "test.0.lastName",
"mount": true,
"value": "Luo"
}
}
Code of Conduct
- [x] I agree to follow this project's Code of Conduct