-
-
Notifications
You must be signed in to change notification settings - Fork 342
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
Using both onMount
and onChange
validators on a field doesn't work
#903
Comments
Okay I actually think this issue is different than I originally thought. My assumption would be that all previous validation errors are cleared when running the next validation but that doesn't seem to be the case. So Can I confirm if this is expected behaviour or not? |
I also think there's something we should look at with the Maybe this can also be configured with an optional flag for the |
I have opened #907 with an implementation behind a configuration flag. |
More annoyingly it |
Is anything being done to resolve stuck |
Fixed with #726 (version 0.34.4) |
Describe the bug
Providing both an
onMount
andonChange
validators toform.Field
does not run validation on change events.For some reason removing the
onMount
validator, causes theonChange
validator to work correctly.Your minimal, reproducible example
https://stackblitz.com/edit/tanstack-form-cgm7xb?file=src%2Findex.tsx
Steps to reproduce
Type more than 2 characters into the input field and notice the error doesn't go away despite a
onChange
validator being applied.Now comment out the
onMount
validator and notice theonChange
validator works, but obviously you get no error on initial load.Expected behavior
Typing more than 2 characters into the input field should cause the validator error to go away with both the
onMount
andonChange
validator defined.How often does this bug happen?
Every time
Screenshots or Videos
Screen.Recording.2024-08-13.at.12.14.48.PM.mov
Platform
Reproduced in Stackblitz so N/A.
TanStack Form adapter
solid-form
TanStack Form version
v0.29.1
TypeScript version
v5.4.2
Additional context
It looks like
onMount
's validator error is just never cleared on user input. It's possible this is expected behavior and if so would you know if I can workaround this?The text was updated successfully, but these errors were encountered: