React-hook-form: Touched fields not getting updated when user append/prepend item

Created on 9 Apr 2020  ·  1Comment  ·  Source: react-hook-form/react-hook-form

Touched fields not getting updated when user append/prepend item

Okay I don't want to get too off track with this because it's not the main issue and I know you're working hard on fixes, but I would like you to think about the relationship between formState.dirty and formState.dirtyFields with me.

If formState.dirty becomes true shouldn't formState.dirtyFields show you what is dirty?

This relationship can be summed up by asking two questions (codesandbox below):

console.log("[is form state dirty?]", formState.dirty);
console.log("[if yes what fields are dirty?]", [...formState.dirtyFields]);
You see, when I click a button in field array the formState.dirty becomes true. Except dirtyFields never tells me what specifically is dirty.

https://codesandbox.io/s/issue-dirtyfields-v532-beta1-6w2y8?file=/src/App.js

_Originally posted by @bluebill1049 in https://github.com/react-hook-form/react-hook-form/issues/1336#issuecomment-611272121_

bug

Most helpful comment

>All comments

Was this page helpful?
0 / 5 - 0 ratings