-
Notifications
You must be signed in to change notification settings - Fork 529
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
feat(Form): handle @error
event
#718
Conversation
Also, I added custom Error to avoid thrown a real error.
The latest updates on your projects. Learn more about Vercel for Git βοΈ
|
onError
and focus-on-fail
props for Form
componentonError
props for Form
component
This code is ready to be review. |
@albertcito I made some changes to include the input identifier directly inside the error object, wdyt? |
onError
props for Form
component@error
event
Looks great, simpler code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tried this and it seems that when the page is loaded on server-side, the id
present in the errors array does not match the actual id of the element so it focuses the wrong input.
The issue came from a silent hydration mismatch on the input identifier (c.f. nuxt/nuxt#14143 (comment)). I found a quick fix here 97ca4c5 which should do it for now. A more elegant solution would be to find a way to make the |
Used to be able to do Is this related? Looks like it's a breaking change of this release. |
@yuelikestocode The |
Issue: #715
β Type of change
π Description
@error
type:(value: FormSubmitEvent<T>) => void
Also I addedfocusOnFail
props. To set the focus to the first element that contains an error. But only works if name is the same thatstate
keyResolves #715
π Checklist