I have a list of objects of blocks, with properties, and id.
The classic way to remove the item from the array won't help me to remove an item, can you tell me why?
Run action:
this.$store.dispatch("removeBlockFromList", id); //id is here!
action:
removeBlockFromList({ commit }, id) {
commit("REMOVE_BLOCK_FROM_LIST", id) // id is here!
}
Mutation:
REMOVE_BLOCK_FROM_LIST(state, id) { //id is here
state.blockList = state.blockList.filter(item => {
return item.id === id; //connection is here too, true
}).shift();
}
I have tried to rewrite the array to an empty array like:
state.blockList = [];
Again not working...