Lodash: _.remove doesn't play nice with Vue

Created on 1 Feb 2017  路  3Comments  路  Source: lodash/lodash

There's an issue when using lodash with Vue when you want to remove a value from a reactive array. The situation is explained clearly here: https://github.com/vuejs/vue/issues/2673

Vue captures the splice call on the array, but because lodash uses Array.splice directly, that capture never takes place, and the observer is never notified.

Q: Why does lodash use Array.prototype instead of calling splice directly on the subject array?

invalid

Most helpful comment

To make the array reactive I normally do this. I re-assign the filtered array into Vue data property

this.items = [
   ...this.items
]

All 3 comments

It seems like Vuejs is using bad practice.

To make the array reactive I normally do this. I re-assign the filtered array into Vue data property

this.items = [
   ...this.items
]

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Alexsey picture Alexsey  路  3Comments

SameerSiddiqui picture SameerSiddiqui  路  3Comments

andreineculau picture andreineculau  路  3Comments

JoMas971 picture JoMas971  路  3Comments

erykpiast picture erykpiast  路  3Comments