TanStack / TanStack/form

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

Open
#2,302 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: runtime scope: core type: enhancement v2
Dominant language
TypeScript
Stars
6.7k
Forks
682
Avg merge
5d 18h
Merged PRs (30d)
7

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the form's internal field-trie implementation and existing public API patterns. Determine how the trie represents default values and dirty state, then clarify the mask representation and API shape before implementation. Done means the API can generate masks for both non-default and dirty fields, with tests covering each mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.