From 0c9c5b877bc15bd4f8a37edfc3a3bb3572aa1d2a Mon Sep 17 00:00:00 2001 From: Joseph Caburnay Date: Thu, 9 Jan 2020 09:32:40 +0100 Subject: [PATCH] [FIX] playground: not all completed is deleted Before this fix, not all completed tasks are deleted when clicking clear completed button because we are looping to a mutated array. Looping thru a copy of the mutated array fixes this problem. --- tools/playground/samples.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/playground/samples.js b/tools/playground/samples.js index 56a9d3b0..cbeb9bef 100644 --- a/tools/playground/samples.js +++ b/tools/playground/samples.js @@ -455,7 +455,7 @@ const actions = { todo.completed = !todo.completed; }, clearCompleted({ state, dispatch }) { - for (let todo of state.todos) { + for (let todo of state.todos.slice()) { if (todo.completed) { dispatch("removeTodo", todo.id); }