vuetifyjs / vuetify

🐉 Vue Component Framework
https://vuetifyjs.com
MIT License
39.88k stars 6.96k forks source link

[Bug Report] v-select with tags writes to array directly #2411

Closed leuprechtroman closed 7 years ago

leuprechtroman commented 7 years ago

Versions and Environment

Vuetify: v0.16.9 Vue: v2.4.2 Browsers: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36 OS: Linux

Steps to reproduce

Add 2 Tags into the Component in the codepen and watch the console

Expected Behavior

It should trigger the computed setter and not write the value directly to the array (which may be stored in vuex and therefore will fail)

Actual Behavior

it triggers the computed setter (which is correct) but also writes to the array directly. This triggers an error in vuex strict mode.

Reproduction Link

https://codepen.io/leuprechtroman/pen/ZaQWmR?editors=1010

KaelWD commented 7 years ago

Orrrrr, you could do it yourself very easily? https://codepen.io/anon/pen/zPrgBr?editors=1011

leuprechtroman commented 7 years ago

Thanks for posting this solution but IMHO this is a behaviour that should be changed. I already found a workaround myself (and probably there are 1000 more of them), so it's not about working around the issue.

The Vue.js 2 Documentation clearly states, that a component that wants to implement v-model has to:

So for a component to work with v-model, it should (these can be configured in 2.2.0+): accept a value prop emit an input event with the new value

Which means that the value should not be modified in place, or am I wrong?

Issues #597 and #357 are the same bad behaviour just with different components. Also everything else works with the computed properties that update the store. Why should this one component be an exception?

Please consider this points and reopen the issue. I'd also be happy to help!

KaelWD commented 7 years ago

Hmm, ok. I wasn't aware that this had been fixed for other components too.

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please direct any non-bug questions to our Discord