Replies: 1 comment 1 reply
-
Also having this issue! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Also having this issue! |
Beta Was this translation helpful? Give feedback.
-
After I submit my form, I call
form.reset(valuesFromApi)
to set the new values as my defaultValues, and be able to set my dirty state, this works as expected. However, this is causing all my components that useuseFieldArray
to remount completely, which causes the internal keys of the items to be recalculated, and all the children to unmount and remount as well, which causes lost focus in input fields etc.I have an autosave which runs every couple of seconds, which is why this loss of focus is such an issue for me. I'm currently working around it by disabling autosave when the user has focus in an input or textarea, but it doesn't feel correct having this, and quite fragile. Eg file inputs also suffer from this, and won't set the value properly if the item has remounted in the meantime.
I've used
shouldUnregister: false
, which doesn't fix my issue.Beta Was this translation helpful? Give feedback.
All reactions