Skip to content

[v2] Add on-demand field mask / dirtyFields generation #2302

Description

@LeCarbonator

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: runtimeThis issue affects the runtime of the library.scope: coreThis issue affects the core package, meaning any adapter is also affected by it.type: enhancementThis requests an enhancement to existing behaviour.v2This issue affects v2 as well.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions