[Vuejs]-Vue.js/vuex UI not updating on programmatic navigation

3👍

In the mutation, instead of doing:

state.records[i] = record;

try following:

Vue.set(state.records, i, Object.assign({}, record))

Why:

Due to limitations in JavaScript, Vue can’t detect when you directly set an item with the index, e.g. vm.items[indexOfItem] = newValue

You can do one of following to overcome this:

state.records.splice(i, 1, record)

or

Vue.set(state.records, i, Object.assign({}, record))

Leave a comment