Skip to content
Source
Sign inSign up
TanStack/form

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

OpenLeCarbonator(GitHub profile, opens in a new tab) opened this issue 3 comments

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.

  1. LeCarbonator(GitHub profile, opens in a new tab) added labelstype: bug

  2. LeCarbonator(GitHub profile, opens in a new tab) added labelsscope: core

  3. LeCarbonator(GitHub profile, opens in a new tab) added labelsarea: runtime

  4. scs0209(GitHub profile, opens in a new tab)commented

    I'd like to work on this. Can I try it?

  5. @scs0209 If you have a concept plan for how to do it, feel free to share. However, we're planning a rework of how submission works behind the scenes, so I don't recommend a PR for this at the moment.

  6. Got it, I'll wait for the submission rework.

Sign in to join this conversation.