I am using v-for in an array of objects. I can push new items to this array and it renders perfectly fine but when I use unshift, it only repeats the last item in the array.
Hmm. What do you mean that it repeats the last item? Do you mean the last item in the array or what? Since, unshift adds to the front of the array, I am wondering the answer.
yes, it renders again the last item of the array again. It seems like the actual array is updating properly but the vue is not rendering the correct item and only duplicating the last one.
oh well, I am getting an array of objects and I want to prepend the object to the array. I just took a loot at the array of objects with the vue tools and its working fine. it seems to be its only the rendering that its not working properly.
@Eco012390 , No I haven't mate. I just did a quick fix for now "reorder the items by date" but I will come back to it as I need to finish other things.
If you're using Vue 1, try adding track-by="$index" to your v-for element.
If using Vue2, try binding a unique key to the v-for like :key="user.user_id"