From 74f84b706991914c2d18756c47434e45df0aa3eb Mon Sep 17 00:00:00 2001 From: AgenticDiego Date: Tue, 1 Sep 2026 14:23:21 +0000 Subject: [PATCH] fix(dashboard): revert task checkbox optimistic update on mutation failure When completeTask mutation fails, the onError handler now calls toggleTask to flip the checkbox back to its original state, preventing the UI from showing an incorrect completed/incomplete status after a server error. --- src/components/dashboard/planning-overview.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/dashboard/planning-overview.tsx b/src/components/dashboard/planning-overview.tsx index 8e459afb..29efe3a5 100644 --- a/src/components/dashboard/planning-overview.tsx +++ b/src/components/dashboard/planning-overview.tsx @@ -282,7 +282,10 @@ function TasksCard({ dashboardData }: { dashboardData: DashboardData | null }) { const priorityQueue = dashboardData?.taskPriorityQueue const { tasks, toggleTask } = useTasksCardState(priorityQueue?.tasks ?? EMPTY_PRIORITY_TASKS) const completeTask = api.task.complete.useMutation({ - onError: () => toast.error('Failed to update task'), + onError: (_, variables) => { + toggleTask(variables.taskId) + toast.error('Failed to update task') + }, }) const handleToggle = (taskId: string) => {