-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
impossible to set setFieldError on array fields with latest toTypedSchema #4211
Comments
This is tricky to have since it means we need to have the field paths as recursive TS literal type instead of keys of the given object. But I believe it is a worthwhile enhancement and will remove all weirdness about setting fields and errors values for nested paths. I will be working on this for the next minor release. |
thanks! |
stumble upon this today, this also will be a problem if the key of the validation schema is dynamic and not defined before. |
@logaretm this breaks in the new version. the value is set to |
@hi-reeve What do you mean? Don't think something was changed related to this since the fix. Got an example? |
take a look at the current version when setting setFieldError using the supposed to be method and if we set the name of the field to be the vue devtools detecting if we name the field format as so with this, if we set the error using the format |
Right, seems like paths should be normalized to use one syntax over the other. I will try to look into what we need to do here. |
thankyou. and regarding setting this field to |
Right, that shouldn't be an issue with the fix since There might be some bugs around this area but thanks to you reporting this, it should be more consistent now. I will tag a release shortly with the fix. |
thankyou for the quick fix! great job! |
What happened?
from this issue
we can
setFieldError
on useFieldArray like thissetFieldError('users[0].name','error message')
but with the latest
toTypedSchema
the autocomplete ofsetFieldError
is only reading the root property of the validationSchemaReproduction steps
ex: users[0].name
...
Version
Vue.js 3.x and vee-validate 4.x
What browsers are you seeing the problem on?
Relevant log output
Demo link
https://stackblitz.com/edit/vitejs-vite-1kvon3?file=src/App.vue
Code of Conduct
The text was updated successfully, but these errors were encountered: