but also i have items selected so i should update it as
function remove(id) {
vm.items = vm.items.filter(item => item.id === id)
vm.selected = vm.selected.filter(item => item.id === id) // from table model
}
and it works, but one thing isn't
i have counter of selected
vm.all = vm.selected.length;
and after filtering of selected items all references are destroyed cause filter return new array (as you know).
i can use splice to mutate vm.selected, but i need immutable solution
Hello
Have situation where i need to filter items when item removed
but also i have items selected so i should update it as
and it works, but one thing isn't i have counter of selected
and after filtering of selected items all references are destroyed cause
filter
return new array (as you know). i can usesplice
to mutatevm.selected
, but i need immutable solutioncan we do it in immutable way?
Thank you