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
initialValue is being reset on change when ResetForm is called #3428
Comments
Please provide a demo on codesandbox for this issue |
Hi @logaretm There are three examples here. The functionality on nonNestedInput is what we expect in output. valueNestedInputX and valueNestedInputY are acting as incorrect and different to nonNestedInput. Why are they acting incorrectly? After clicking 'Reset form' and once you change the value for either valueNestedInputX or valueNestedInputY (in the UI), the initialValue for these changes to be the same as the current value (which is incorrect) - note that in the nonNestedInputMeta, this does not change when the valueNonNestedInput changes. |
Thank you for reporting this, the issue was caused by the good old reference type not being cloned before assignment which means both the current input and initial value operated on the same values. The fix should be out in the next patch for |
Thanks @logaretm this is great news. I wanted to just point out something from the sandbox which may have gone unnoticed - im not sure if your fix would have addressed this.. In the first screenshot below, the initial values seem to be registered correctly, however when I click reset form, there is an additional 'input.y' added in the meta. |
When dealing with values, you cannot specify paths. So |
Ok, understood. Thanks @logaretm |
this fix is referenced from logaretm/vee-validate#3428
What happened?
When calling the ResetForm, such as below:
resetForm({ values: { criteria: { card_type: 1 } } });
;This changes the initial value, which is correct, but then once I change my value in my form field again in my UI (such as updating to 2), it is changing the initialValue to the current value (in this case 2). I don't want initialValue to update on change, only when I call the resetForm function.
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
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: