mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 20:42:43 +00:00
fix(mood): surface a toast when a list delete fails
The mood list delete mutation had no onError handler, so a rejected DELETE cleared no state and showed nothing — the row stayed in place with no signal the request was refused. Add an error toast on failure, mirroring the medication-card silent-failure fix.
This commit is contained in:
1 parent
31301cc889
commit
ccf56b8dbb
1 file changed
+8
@@ -63,6 +63,7 @@ import {
|
||||
} from "lucide-react";
|
||||
import { useId, useState } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { toast } from "sonner";
|
||||
import { formatDateTime } from "@/lib/format";
|
||||
import { useTranslations, useFormatters } from "@/lib/i18n/context";
|
||||
import {
|
||||
@@ -206,6 +207,13 @@ export function MoodList({ onAddFirst }: MoodListProps = {}) {
|
||||
onSuccess: () => {
|
||||
void invalidateKeys(queryClient, moodDependentKeys);
|
||||
},
|
||||
// v1.11.5 — a failed delete used to fail silently (no onError handler),
|
||||
// leaving the row in place with no signal that the request was rejected.
|
||||
// Surface the failure so the user knows to retry. Mirrors the v1.11.3
|
||||
// medication-card silent-failure fix.
|
||||
onError: () => {
|
||||
toast.error(t("mood.deleteError"));
|
||||
},
|
||||
});
|
||||
|
||||
const updateMutation = useMutation({
|
||||
|
||||
Reference in new issue
Block a user