Skip to content

Async validator doesn't re-trigger isValidating after first failed validation #2372

Description

@AlexanderHott

Describe the bug

When you have a form with an async validator, the field().state.meta.isValidating property doesn't go back to true when you trigger the async validation after the first time.

Your minimal, reproducible example

https://stackblitz.com/~/github.com/AlexanderHott/tanstack-solid-form-async-validator-bug

Steps to reproduce

  1. Type admin
  2. See Checking username... message for 2000ms
  3. Wait for Username is already taken
  4. Backspace until the username is empty
  5. Type asdf

Expected behavior

I expect the Checking username... message to appear again, because the validator is validating, but there is no pending/loading message.

The validator error does show up correctly afterwards.

How often does this bug happen?

Every time

Screenshots or Videos

Screencast_20260904_042635-00.00.00.000-00.00.09.558.webm

Platform

  • OS: Linux 7.0.0-30-generic
  • Browser: Chrome 148.0.7778.178

TanStack Form adapter

solid-form

TanStack Form version

1.33.5

TypeScript version

5.9.3

Additional context

I think the relevant code is here

rawError = await new Promise((rawResolve, rawReject) => {
if (field.timeoutIds.validations[validateObj.cause]) {
clearTimeout(field.timeoutIds.validations[validateObj.cause]!)
field.endValidation()
}
field.timeoutIds.validations[validateObj.cause] = setTimeout(
async () => {
if (controller.signal.aborted) return rawResolve(undefined)
try {
rawResolve(
await this.runValidator({
validate: validateObj.validate,
value: {
value: field.store.state.value,
fieldApi: field,
signal: controller.signal,
validationSource: 'field',
},
type: 'validateAsync',
}),
)
} catch (e) {
rawReject(e)
}
},
validateObj.debounceMs,
)

Activity

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

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