How to update default values while keeping any dirty values #1958
Unanswered
SevereOverfl0w
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Similar to the async initialisation of the form, I'd like to allow iterative changes to the initial state from the server. The idea is that the user has a form which they can drag and drop different entities into. When these entities are added, they will fetch the default values from the server for all entities. But if any entity has already been made dirty then those should be left alone.
This probably isn't too bad for a small form to do a manual isDirty lookup per attribute and make choices based on that. But for a large nested form, this becomes tedious to match up the values from the new & old data in a recursive way.
RHF supports keepDirtyValues for this use case which is very helpful!
Beta Was this translation helpful? Give feedback.
All reactions