Search code examples
eventsvuexmutation

Able to update state one by one character


I've have quite strange situation here.

https://codesandbox.io/s/7myoj9zp3q

When I want to add new row, I am able to add a new inputs (append to state null values), but I am able to type only one character a time (input looses focus). Am I missing some events or what?

PS - I know that there might be another way around (adding to state ready/almost ready object), but I wanted to get this variant to work.


Solution

  • Fixed by following suggested way read on Mutations Follow Vue's Reactivity Rules https://vuex.vuejs.org/en/mutations.html#mutations-follow-vues-reactivity-rules:

    Vue.set(obj, 'newProp', 123)