form icon indicating copy to clipboard operation
form copied to clipboard

form.validateAllFields became not work from 1.0.0 (regression)

Open viktor-galytskyi opened this issue 11 months ago • 5 comments

Describe the bug

const validationErrors: ValidationError[] = await form.validateAllFields('submit'); return empty ValidationError array even if some fields are not valid.

in a screenshot, there are two places with "calculation[0].name" validation data.

  1. state.errors (error present)
  2. fieldMeta (no error, Why?)

Field "...name" is not valid, but fieldMeta without an error.

Image
  1. isFieldsValid: true but errors array not empty

Your minimal, reproducible example

code

Steps to reproduce

define form. Make some fields not valid. Trigger await form.handleSubmit(); Take a look at validationErrors: ValidationError[];

const handleSave = async (form) => { await form.handleSubmit();

const validationErrors: ValidationError[] = await form.validateAllFields('submit');

console.log('form', form);

};

Expected behavior

  1. form.validateAllFields('submit'); should return errors
  2. fiealdMeta should be marked as not valid in the correspondent field
  3. isFieldsValid* should be false in case form fields not valid.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • MacOS (last)
  • Chrome (last)

TanStack Form adapter

react-form

TanStack Form version

1.0.0

TypeScript version

No response

Additional context

No response

viktor-galytskyi avatar Mar 03 '25 17:03 viktor-galytskyi

You mentioned this was a regression - from which version?

crutchcorn avatar Mar 03 '25 18:03 crutchcorn

@crutchcorn 0.41.0 was good

viktor-galytskyi avatar Mar 03 '25 18:03 viktor-galytskyi

I can't reproduce this error. It's working for me. Please include a minimal reproduction error.

crutchcorn avatar Mar 03 '25 18:03 crutchcorn

having same issue from version 1.1.2

Davit-000 avatar Mar 25 '25 12:03 Davit-000

I think this is a minimal example: https://stackblitz.com/edit/vitejs-vite-obprn36n?file=src%2FApp.tsx&terminal=dev

literalpie avatar Sep 22 '25 14:09 literalpie