Please how may we delete items by key in a Vuex state object and still have computed properties bound to getters automatically update?
I have a simple store:
const state {
users: {} // object of objects keyed by userid
}
const getters {
admins: state => Object.values(state.users).filter(o => o.role === 'administrator'),
managers: state => Object.values(state.users).filter(o => o.role === 'manager'),
counters: state => Object.values(state.users).filter(o => o.role === 'counter'),
}
const mutations {
DELETE_USER (state, userid) {
delete state.users[userid] // the user id deleted, i can verify this in dev-tools
}
}
The user is deleted, i can verify this in vue dev-tools, but the computed properties in my vue component do not see the updates:
...
computed: {
admins: this.$store.getters('admins'),
managers: this.$store.getters('managers'),
counters: this.$store.getters('counters')
},