[Vuejs]-VueJS with Vuex โ€“ Replace item (object) in array stored in Vuex with splice doesn't re-render list of items

0๐Ÿ‘

If you are fetching records from an API I recommend that you update by fetching from the API, and if you want to update the item within your state, try this:

updateRecord(state, updatedRecord) {
  const { title, value } = updatedRecord;
  let recordIdx = state.records.find((rec) => rec._id === updatedRecord._id);

  recordIdx.title = title
  recordIdx.value = value 
  ...
},

Leave a comment