Skip to content

Conversation

@mhuggins
Copy link

@mhuggins mhuggins commented Jan 9, 2026

🎯 Changes

Passing an asynchronous function to a synchronous validator (i.e.: onBlur, onChange, onDynamic, onSubmit) is a bit of a foot-gun given that it does not produce any typescript errors, but it also results in the form/field validation function running after the core validation logic.

This updates the types for these validator functions on both FormApi and FieldApi to prevent passing a function that returns a Promise.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

@changeset-bot
Copy link

changeset-bot bot commented Jan 9, 2026

🦋 Changeset detected

Latest commit: 2198362

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@tanstack/form-core Patch
@tanstack/angular-form Patch
@tanstack/form-devtools Patch
@tanstack/lit-form Patch
@tanstack/react-form Patch
@tanstack/solid-form Patch
@tanstack/svelte-form Patch
@tanstack/vue-form Patch
@tanstack/react-form-devtools Patch
@tanstack/solid-form-devtools Patch
@tanstack/react-form-nextjs Patch
@tanstack/react-form-remix Patch
@tanstack/react-form-start Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Passing an asynchronous function to a synchronous validator (i.e.: `onBlur`, `onChange`,
`onDynamic`, `onSubmit`) is a bit of a foot-gun given that it does not produce any typescript
errors, but it also results in the form/field validation function running after the core
validation logic.

To prevent this, update the types for these validator functions on both `FormApi` and
`FieldApi` to prevent passing a function that returns a `Promise`.
@mhuggins mhuggins force-pushed the prevent-synchronous-promises branch from 5924423 to 2198362 Compare January 9, 2026 15:57
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

Successfully merging this pull request may close these issues.

1 participant