form icon indicating copy to clipboard operation
form copied to clipboard

state.canSubmit value flickering with async validation

Open parkm opened this issue 1 year ago • 1 comments

Describe the bug

https://tanstack.com/form/latest/docs/framework/react/examples/simple In this example just start typing and you'll notice the submit button flickers on and off

Your minimal, reproducible example

https://tanstack.com/form/latest/docs/framework/react/examples/simple

Steps to reproduce

  1. Continuously type in the First Name input
  2. Notice the submit button's disabled state is flickering on and off

Expected behavior

I would expect the submit button to be disabled until the debounce and validation promise finishes

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Chrome, MacOS Sonoma 14.5

TanStack Form adapter

react-form

TanStack Form version

0.29.1

TypeScript version

No response

Additional context

No response

parkm avatar Aug 13 '24 20:08 parkm

canSubmit seems to be working as intended, that is disabled while the form is validating. There's something that seems off though, namely the isValidating flag on the field.

If you type something and type again before the debounce, it seems that even if the validator is running, the isValidating is set to false.

Balastrong avatar Aug 14 '24 07:08 Balastrong

This issue has been fixed by https://github.com/TanStack/form/pull/962, so I'm closing it.

fulopkovacs avatar Jan 02 '25 11:01 fulopkovacs