fixing bug with pureFunction clear

This commit is contained in:
Ken
2019-02-26 14:22:03 -08:00
parent 540e7fb638
commit ad065d4b4a
9 changed files with 26 additions and 19 deletions

View File

@@ -34,8 +34,8 @@ export function complete(state: Store['todos'], id: string) {
export function clear(state: Store['todos']) {
const newTodos = { ...state };
Object.keys(state.todos).forEach(key => {
if (state.todos[key].completed) {
Object.keys(state).forEach(key => {
if (state[key].completed) {
delete newTodos[key];
}
});