TanStack / TanStack/form

🐛Validation regression bug in react-form@1.28.4

Open
#2,084 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

v1 v2: needs investigation
Dominant language
TypeScript
Stars
6.7k
Forks
682
Avg merge
5d 18h
Merged PRs (30d)
7

Description

Describe the bug

There appears to be a regression introduced in react-form@1.28.4 where validation is firing on submit but not in react-form@1.28.3.

After showing and hiding the field isTouched is false for 1.28.3 but true for 1.28.4

Your minimal, reproducible example

https://stackblitz.com/edit/vitejs-vite-wr2gnlx5

Steps to reproduce
  1. Check "Enter first name"
  2. Click "Submit", you will see a "You must enter a name" error
  3. Uncheck "Enter first name"
  4. Click "Submit"
  5. You should see an alert indicating the submission was successful and the were no validation errors

In the terminal run, the following and repeat the steps

npm i @tanstack/react-form@1.28.4
npm install && npm run dev

This time the validation runs again on submit causing a validation error preventing submission

Expected behavior

I would expect the same behaviour across both version, specifically for the field to not be validated as it's been reset

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

See reproduction

TanStack Form adapter

react-form

TanStack Form version

v1.28.3

TypeScript version

No response

Additional context

No response

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 with the linked StackBlitz reproduction and compare @tanstack/react-form versions 1.28.3 and 1.28.4 using the npm commands in the issue. Repeat the field show, submit, hide, and submit sequence while checking isTouched and validation state. Done means the reset field no longer causes a validation error after it is hidden.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.