-
-
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
resetForm not fully clearing errors when used with v-model #4311
Comments
Following up to this, I found out what is causing the issue. Inside the component file If it's easy enough to explain, it would be great to know why this still works on v4.8.6 vs >=4.9.0, otherwise this can be marked as closed. |
4.9 had a major refactor under the hood. It is possible that there are two write operations forcing a re-validation after a reset. I can't see the behavior in the example, can you update it so it triggers the issue? I would like to get to the bottom of it and explain if its intended as of 4.9 or if its something that needs fixing. |
@logaretm apologies, I forgot to undo changes when I was testing fixes out. Things are reverted now so you should be able to see the issue [typing something in the field, then clicking reset form]. Something again I noticed, using |
Took a look again, and it is not a bug. The button rendered by default has a type of
If you switch the button type to Not sure what a good workaround is, this feels like a weird limitation. I think you could either:
Now why did that ever work in 4.8, I'm not sure. Looking at this, it should've never worked. |
Thanks, appreciate the explanation! |
I'm having this same issue and moving the button outside of the Form does not seem to fix it. In my case, my custom component has a watcher to detect external VModel modifications to trigger handleChange. In 4.8.5, resetForm did not trigger any validations after the value is updated, but now it is showing required errors. As @emikoshi says, running resetForm again removes the errors. |
@diegocsan I have explained why it happened in this issue and to me the behavior happening here makes sense. The form is both resetting and submitting so it is down to a race condition for whichever to run last. One possible reason is reset was doing less steps in 4.8. Since you created a new issue, provide an example for it and I can check it out, it could be a bug or a case like this where it is intended but wasn't visible in previous releases. |
Extended the information in #4323 |
What happened?
I recently upgraded from v4.8.6 to v4.9.6 and have noticed some strange behavior with resetForm. Upon calling
resetForm
which I expose from the<Form>
slot, the fields will still show an error message. It isn't until a second call/click toresetForm
do the error message dissappear.I don't think my use case is all that out of the ordinary but I do have v-models on my component wrappers, they take advantage of
useField
in tandem with Vuetify. I haven't had an issue with usingresetForm
in this manner until upgrading. I did some rollbacks and confirmed this issue persists with any version >= 4.9.0.Some other things worth mentioning:
resetForm
.resetField
just to see if that was working and can confirm there is no issue using it with my use case stated above.Reproduction steps
Version
Vue.js 3.x and vee-validate 4.x
What browsers are you seeing the problem on?
Relevant log output
No response
Demo link
https://stackblitz.com/edit/vee-validate-v4-vuetify-ij2lnu?file=src%2FApp.vue
Code of Conduct
The text was updated successfully, but these errors were encountered: