Skip to content

validateAllFields immediately after form.reset doesn't work #1487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jashworth opened this issue May 7, 2025 · 2 comments
Open

validateAllFields immediately after form.reset doesn't work #1487

jashworth opened this issue May 7, 2025 · 2 comments

Comments

@jashworth
Copy link

Describe the bug

form.validateAllFields (line 130) does not appear to revalidate the fields after form.reset({ ... })

...at least not synchronously (see lines 133-135)

Your minimal, reproducible example

https://codesandbox.io/p/devbox/fervent-ives-32x45k

Steps to reproduce

  1. Observe the initial error ("must not be before 2025-06-02") in the Run Date field of the form
  2. Select the "Dead" radio button
  3. Select the "Once" radio button
  4. Observe the date is the same as before but the error has gone, despite the call to form.validateAllFields (line 130)

Expected behavior

form.validateAllFields (line 130) revalidates all fields, resulting in the error being displayed

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Windows
Chrome (latest)

TanStack Form adapter

react-form

TanStack Form version

1.90.0

TypeScript version

5.7.2

Additional context

The aim is to use form.reset({ ... }) to set multiple co-variant fields together, revealing any constraint violations to the user as soon as the values have been set.

Is there an alternative way to revalidate after reset, preferably one that doesn't rerender the entire component?

@harry-whorlow
Copy link
Contributor

@jashworth I think you've left your codeSandbox as private, as clicking the link provided doesn’t open one 😅

I haven't looked but do you think this could be related to #1485, if you could do a little investigation it would help us out a bunch 😄 if not we will take a look when we get some time!

@jashworth
Copy link
Author

Oops!

is public now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants