[Vuejs]-Vue.js: Child Component mutates state, parent displays property as undefined

0👍

If you add anything into a list of items that are displayed by v-for, you have to set a unique key. Based on your explanation, I assume that your key is the index and when you add a new item, you mess with the current indexes. Keys must be unique and unmutateable. What you need to do is to create a unique id for each element.

{
  id: Math.floor(Math.random() * 10000000)
}

When you create a new task, use the same code to generate a new id, and use id as key. If this doesn’t help, share your d-table and related vuex code too.

Leave a comment