Skip to content
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

setValue does not apply changes to model when lazy modifier is present #1465

Closed
jaredmcateer opened this issue Mar 11, 2020 · 3 comments · Fixed by #1467
Closed

setValue does not apply changes to model when lazy modifier is present #1465

jaredmcateer opened this issue Mar 11, 2020 · 3 comments · Fixed by #1467
Labels

Comments

@jaredmcateer
Copy link

Version

1.0.0-beta.32

Reproduction link

https://github.com/jaredmcateer/vtu-set-value

Steps to reproduce

Clone the minimal test case repo, run npm install once that is complete run node test.js The assert will fail on line 35 as the model has not updated. Commenting out line 35 will allow the remaining assert to run, which will pass because the change event has been triggered.

What is expected?

When calling setValue the model should be updated to reflect that value

What is actually happening?

setValue triggers an "input" event on text input/textareas. A model with the lazy modifier does not update the model until the change event is triggered (see: https://vuejs.org/v2/guide/forms.html#lazy)


If the desire is for setValue to mimic typing perhaps then the documentation should indicate that setValue must be accompanied by a triggering of the change event if the lazy modifier is present or an optional parameter could be passed to setValue to force a change event.

@jaredmcateer jaredmcateer changed the title setValue does not apply changes to model when lazy attribute set setValue does not apply changes to model when lazy modifier is present Mar 11, 2020
@lmiller1990
Copy link
Member

Good catch. I think we should support lazy. Not sure how we would detect that an element is lazy, but we might be able to get away by just calling change no matter what (shouldn't hurt?). The change would go here.

@dobromir-hristov
Copy link
Contributor

I was thinking about this last night. I dont think we can detect if lazy modifier is used, as that just changes the event listener applied by Vue.

If we fire both events, then there is no need for that distinction between elements. Could that probably add more issues for current users?

@lmiller1990
Copy link
Member

Turns out we can, conveniently there is a _vModifiers object that has things like lazy: true, making this easy to implement!

Please review @dobromir-hristov and @jaredmcateer : #1467

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants