T
TanStack2y ago
compatible-crimson

Delay between <form> onSubmit and react-form onSubmit callback called

When I add a console log to both the form's onSubmit callback, and the useForm hook's options onSubmit callback, I see there is a slight, but noticeable, delay between the two logs.
4 Replies
genetic-orange
genetic-orange2y ago
Can you help us debug this? I've been unable to figure out what the performance problem is because I can't reproduce it
compatible-crimson
compatible-crimsonOP2y ago
Let me see if I can make a small demo. What does the form hook do between calling form.handleSubmit(); and when the useForm onSubmit callback is called? Would it make a difference if the callback is async or not? I noticed it's an async func in the quick start example. I wonder if it matters if no validation is defined. I noticed handleSubmit does some async stuff, like
// Validate all fields
await this.validateAllFields('submit')
// Validate all fields
await this.validateAllFields('submit')
before onSubmit is called.
genetic-orange
genetic-orange2y ago
Yeah but that should be empty Like a micro tick at most
compatible-crimson
compatible-crimsonOP2y ago
Yeah, that's what I'd expect.

Did you find this page helpful?