fix: surface remaining silent mutation failures

Four more mutations had no error feedback: equipment condition change,
task completion, and notification mark-as-read all failed silently.
More importantly, the offline sync badge computed a result.failed
count from syncPendingInspections() but never displayed it - an entry
rejected by the server (e.g. a validation rule) would sit in the
offline queue indefinitely with zero indication to the beekeeper why
it never syncs. Both the failed-count and outright sync-mutation
rejection now surface a toast.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
Nick SzaunigandClaude Sonnet 5 committed 2026-09-09 11:41:36 +02:00
1 parent 997dadfaaa
commit dfb4de81f8
4 files changed
+13

No files matched your search

@@ -3,6 +3,7 @@
import { useParams } from "next/navigation";
import { Wrench } from "lucide-react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { toast } from "sonner";
import { fetchEquipment, updateEquipment } from "@/lib/equipment/api";
import { EquipmentCondition } from "@/lib/equipment/types";
import { EQUIPMENT_CONDITIONS, EQUIPMENT_CONDITION_LABELS } from "@/lib/equipment/labels";
@@ -32,6 +33,7 @@ export default function EquipmentDetailPage() {
void queryClient.invalidateQueries({ queryKey: ["equipment", params.id] });
void queryClient.invalidateQueries({ queryKey: ["equipment"] });
},
onError: () => toast.error("Zustand konnte nicht gespeichert werden"),
});
if (isLoading) {
@@ -4,6 +4,7 @@ import { useState } from "react";
import Link from "next/link";
import { ListTodo } from "lucide-react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { toast } from "sonner";
import { completeTask, fetchTasks } from "@/lib/tasks/api";
import { TaskPriority, TaskStatus } from "@/lib/tasks/types";
import { TASK_PRIORITIES, TASK_PRIORITY_LABELS, TASK_STATUS_LABELS } from "@/lib/tasks/labels";
@@ -40,6 +41,7 @@ export default function TasksPage() {
onSuccess: () => {
void queryClient.invalidateQueries({ queryKey: ["tasks"] });
},
onError: () => toast.error("Aufgabe konnte nicht erledigt werden"),
});
const [now] = useState(() => Date.now());