Skip to content

Using both onMount and onChange validators on a field doesn't work #903

Closed

Description

Describe the bug

Providing both an onMount and onChange validators to form.Field does not run validation on change events.

For some reason removing the onMount validator, causes the onChange 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 the onChange 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 and onChange 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions