Update optimistic timestamp to enable smart merge strategy

- Set updated_at to current ISO timestamp during optimistic updates
- Ensures smart merge logic triggers when server responses are stale
- Fixes CodeRabbit review suggestion about timestamp comparison effectiveness

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
leex279
2025-09-09 23:20:01 +02:00
parent 5ed05083ec
commit 6cce7c5e1c

View File

@@ -112,7 +112,10 @@ export function useUpdateTask(projectId: string) {
// Optimistically update
queryClient.setQueryData<Task[]>(taskKeys.all(projectId), (old) => {
if (!old) return old;
return old.map((task) => (task.id === taskId ? { ...task, ...updates } : task));
const nowIso = new Date().toISOString();
return old.map((task) =>
task.id === taskId ? { ...task, ...updates, updated_at: nowIso } : task,
);
});
return { previousTasks };