TanStack / TanStack/form

[v2] Unrendered fields are not marked as touched on submission

Open
#2,299 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Submitting a form does not mark fields as touched if they are not currently rendered. This affects virtualized forms, where only a subset of fields may be rendered at the time of submission.

Expected behavior

After the user attempts to submit the form, fields should be considered touched even if they were not rendered at the time.

Actual behavior

Fields that were not rendered when the form was submitted retain the default isTouched value of false.

Some thoughts

One possible fix is to keep submissionAttempts in a separate atom and have fields subscribe to it. When submissionAttempts > 0, the default value of isTouched should be true instead of false.

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 tracing form submission handling and how submissionAttempts and isTouched are represented for fields that are not currently rendered. Reproduce the virtualized-form case, then verify that submitting marks both rendered and unrendered fields as touched while preserving existing behavior for rendered fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
67/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.