-
-
Notifications
You must be signed in to change notification settings - Fork 131
Passing function as mask causes infinite loop when used with vee-validate #511
Comments
* now directive will compare previous mask result with the current one if the binding value is a function when triggering update * `input` event will not fire if calculated masked value is the same as the value of the input
* now directive will compare previous mask result with the current one if the binding value is a function when triggering update * `input` event will not fire if calculated masked value is the same as the value of the input
* now directive will compare previous mask result with the current one if the binding value is a function when triggering update * `input` event will not fire if calculated masked value is the same as the value of the input
Same issue without vee-validate |
Hiya folks! If you're visiting this in the future, here's how I managed to solve this problem: You /can not/ use a computed property OR pass a function directly to
|
This will solve most things but will still trip when using currency mask with decimal, v-mask's |
V-Mask and Vue versions
2.2.4, 2.6.12
Reproduction Link
https://codesandbox.io/s/v-mask-demo-forked-ch575?file=/components/Input.vue
Steps to reproduce
input
events get continously emitted causing re-rendersWhat is Expected?
Adding function expression as mask should not trigger
input
events on everycomponentUpdated
What is actually happening?
I am not quite sure what exacly happens there, but I noticed that if I remove
v-slot
(scoped slot) fromValidationObserver
then the problem disappears. Not sure why, but seems like v-maskcomponentUpdated
triggers newinput
event on every component re-render which then gets listened byValidationObserver
which re-renders slotted content and v-mask again triggersinput
event causing a loop. Is there any specific reason why thecomponentUpdated
method does not compare function results ? I mean this code.What is the purpose of marking the mask as changed if
isFunction(value)
?The text was updated successfully, but these errors were encountered: