fix: prefer id matching when deleting todos (Cubic feedback)

- When deleting tasks, prefer matching by id if present

- Fall back to content matching only when todo has no id

- Prevents deleting unrelated todos with same subject
This commit is contained in:
YeonGyu-Kim
2026-02-14 19:07:04 +09:00
parent 02e0534615
commit 1bb5a3a037

View File

@@ -108,11 +108,16 @@ export async function syncTaskTodoUpdate(
});
const currentTodos = extractTodos(response);
const taskTodo = syncTaskToTodo(task);
const nextTodos = currentTodos.filter((todo) =>
taskTodo
? !todosMatch(todo, taskTodo)
: todo.content !== task.subject
);
const nextTodos = currentTodos.filter((todo) => {
if (taskTodo) {
return !todosMatch(todo, taskTodo);
}
// Deleted task: match by id if present, otherwise by content
if (todo.id) {
return todo.id !== task.id;
}
return todo.content !== task.subject;
});
const todo = taskTodo;
if (todo) {