Hi there, I'd like to apologize if this is not the right place to post for this feature request.
I see that through FormSpy there is a way to get the list of touched fields. However there doesn't seem to be a way to get the list of dirty fields.
I won't describe my use case (let's just say that I just want to handle dirty fields on Submit), but I'm curious to know why this isn't implemented the same way touched fields are.
Many thanks!
Because someone requested it and I implemented it. Doing the same for dirty shouldn't be hard.
Published fix in v4.9.0.
Wow that was fast! Many thanks ;)
You got lucky and this was more interesting/easy than what I'm supposed to be doing. 馃槅
Sorry if I'm pushing here, also I understand if I need to open a new issue, but wouldn't it make sense to also return dirtyFields in formApi.getState()? It's just one line to add to the attribute list in here? https://github.com/final-form/final-form/blob/90fb6cb29a269c38cc301387b675cbfb53cf08c7/src/FinalForm.js#L83
I think visited is also missing from state. Thanks btw, this lib is awesome.
EDIT: happy to do a PR if you'd prefer.
Oh, interesting, you caught a much deeper bug just now. Yes, dirtyFields should be returned from getState().
But no, it's not just a matter of changing that line, since dirtyFields should not be kept in InternalFormState because it (and visited and touched) are all calculated/derivable from other parts of the state.
Fixing.
Published fix in v4.9.1.
That鈥檚 my lucky day :)
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
You got lucky and this was more interesting/easy than what I'm supposed to be doing. 馃槅