nuxt / ui

A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.
https://ui.nuxt.com
MIT License
4.11k stars 542 forks source link

v2.19.2 @nuxt/ui breaks async form validation with yup #2691

Open akarelas opened 2 days ago

akarelas commented 2 days ago

Environment

- Operating System: Linux
- Node Version:     v20.18.0
- Nuxt Version:     3.14.159
- CLI Version:      3.15.0
- Nitro Version:    2.10.4
- Package Manager:  npm@10.8.2
- Builder:          -
- User Config:      default
- Runtime Modules:  @nuxt/ui@2.19.2, @nuxt/eslint@0.7.1, @pinia/nuxt@0.7.0
- Build Modules:    -

Version

v2.19.2

Reproduction

This is the same page with @nuxt/ui v2.19.2 : https://stackblitz.com/edit/nuxt-ui-jxfvsf?file=pages%2Findex.vue (validation doesn't work)

This is the same page with @nuxt/ui v2.18.7 : https://stackblitz.com/edit/nuxt-ui-np2mhw?file=pages%2Findex.vue (validation works)

Description

Async form validation with yup of the "username" field works perfectly in v2.18.7 - by entering a 4-letter word for example, after one second you get a "username already exists" error underneath the field, as expected.

However when we use v2.19.2, no validation of the "username" field works - neither the async nor the min length one.

On my local dev, I get this error in the console in v2.19.2 when I leave the field:

Uncaught (in promise) Error: Validation test of type: "duplicate-username" returned a Promise during a synchronous validate. This test will finish after the validate call has returned

Additional context

No response

Logs

benjamincanac commented 2 days ago

@rdjanuar Didn't you make a fix for this already? 🤔

rdjanuar commented 2 days ago

@benjamincanac I forgot to resolve async validation in Yup schema. I had previously only fixed this issue in Joi