Applications often need to send a partial update containing only relevant form fields. It would be useful to expose an API that generates a field mask on demand for either:
- fields whose values differ from their defaults; or
- fields currently marked as dirty.
Consumers could use the resulting mask with whichever API or patch format their application relies on. The form library would identify the relevant fields without prescribing how the final patch is constructed.
React Hook Form offers dirtyFields, but a dedicated API for generating both dirty-field and non-default-value masks could provide a more direct workflow for preparing patches.
Some thoughts
Because the form already owns the field trie, the masks could be derived from that internal structure when requested. The exact API and mask representation are open for discussion.
Applications often need to send a partial update containing only relevant form fields. It would be useful to expose an API that generates a field mask on demand for either:
Consumers could use the resulting mask with whichever API or patch format their application relies on. The form library would identify the relevant fields without prescribing how the final patch is constructed.
React Hook Form offers
dirtyFields, but a dedicated API for generating both dirty-field and non-default-value masks could provide a more direct workflow for preparing patches.Some thoughts
Because the form already owns the field trie, the masks could be derived from that internal structure when requested. The exact API and mask representation are open for discussion.