Commit bf2ef24f authored by Peter Hegman's avatar Peter Hegman Committed by Mark Florian

Fix Vuex "Updating complex state" example

parent 2a4b477b
......@@ -216,12 +216,15 @@ A mutation written like this is harder to maintain and more error prone. We shou
// Good
export default {
[types.MARK_AS_CLOSED](state, itemId) {
const item = state.items.find(i => i.id == itemId);
Vue.set(item, 'closed', true)
const item = state.items.find(x => x.id === itemId);
state.items.splice(index, 1, item)
}
}
if (!item) {
return;
}
Vue.set(item, 'closed', true);
},
};
```
This approach is better because:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment