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:
parent
02e0534615
commit
1bb5a3a037
@ -108,11 +108,16 @@ export async function syncTaskTodoUpdate(
|
|||||||
});
|
});
|
||||||
const currentTodos = extractTodos(response);
|
const currentTodos = extractTodos(response);
|
||||||
const taskTodo = syncTaskToTodo(task);
|
const taskTodo = syncTaskToTodo(task);
|
||||||
const nextTodos = currentTodos.filter((todo) =>
|
const nextTodos = currentTodos.filter((todo) => {
|
||||||
taskTodo
|
if (taskTodo) {
|
||||||
? !todosMatch(todo, taskTodo)
|
return !todosMatch(todo, taskTodo);
|
||||||
: todo.content !== task.subject
|
}
|
||||||
);
|
// 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;
|
const todo = taskTodo;
|
||||||
|
|
||||||
if (todo) {
|
if (todo) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user