-
-
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
Unable to change form's initialValues back to empty object with resetForm force: true #4680
Comments
Actually, to be more specific, the problem is that you can't force set some or all of the initialValues to undefined, unless you explicitely define them as 'undefined'. Omitting them is just not enough. This can be problematic for some generic use-cases, where you don't/can't construct an object with all of its properties to undefined, but would rather pass a empty object {} to reset initial values. I made a test example:
|
What happened?
Hello,
The
resetForm
function allows to resetting a form's meta fields, also providing new initial values.There is an edge-case when the new initial values provided are an empty object
{}
. Theform.meta.initial
simply isn't reflected, it stays to the previous value is has.I'm using explicitely
{ force: true }
to tell vee-validate not to merge the values passed with the existing, but to replace them, doesn't work nonetheless.Looking at the source code, it looks like it is in
setInitialValues
that the update of these fields are done.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
See above
Code of Conduct
The text was updated successfully, but these errors were encountered: