Skip to content

isValidating state updates to false before debounced async validation completes #2045

@AdrianLea

Description

@AdrianLea

Describe the bug

isValidating form state updates to false before debounced async validation completes. For example when the first async validation is resolving and a second async validation is triggered, once the first async validation resolves, isValidating is set to false even though the second async validation is still in flight.

Your minimal, reproducible example

https://stackblitz.com/edit/tanstack-form-s6svm3er?file=src%2Findex.tsx

Steps to reproduce

  1. Type in "erro" in firstname
  2. Wait roughly half a second then add an "r" to make "error"
  3. isValidating disappears -> false
  4. After about half a second later the error appears

Expected behavior

As a user I expect, isValidating to be true whenever there is an async validation in flight. So the isValidating... text should not disappear before all async validations have completed. My specific use-case is showing a loading state while async validation is ongoing, however since the isValidating
state becomes false early this can be misleading to users.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Google Chrome

TanStack Form adapter

react-form

TanStack Form version

1.28.3

TypeScript version

v5.8.3

Additional context

No response

Metadata

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