fix(checkups): use the shared query-error primitive on the Vorsorge list

The section carried a bespoke muted error row with its own retry button —
the exact drift QueryErrorRow was made to absorb. Swap it for the shared
primitive so the failure reads as foreground content. Test watched the
bespoke row first.
This commit is contained in:
Marc-André Bombeck committed 2026-08-09 04:28:18 +02:00
1 parent 44582008e9
commit f6a0ee4623
2 files changed
+20 -18

No files matched your search

@@ -89,6 +89,21 @@ describe("<VorsorgeSection> loading + empty", () => {
expect(html).not.toContain('data-slot="empty-state"');
});
it("surfaces a read failure through the shared query-error primitive with retry", () => {
remindersMock.mockReturnValue({
data: undefined,
isLoading: false,
isError: true,
refetch: vi.fn(),
});
const html = render(<VorsorgeSection />);
expect(html).toContain('data-slot="query-error-row"');
expect(html).toContain('data-slot="query-error-row-retry"');
// Not the empty state, and no longer the muted bespoke row.
expect(html).not.toContain('data-slot="empty-state"');
expect(html).not.toContain('data-slot="vorsorge-error"');
});
it("routes the no-data case through the shared EmptyState with an action", () => {
remindersMock.mockReturnValue({ data: [], isLoading: false });
const html = render(<VorsorgeSection />);
@@ -38,7 +38,6 @@ import {
CalendarPlus,
CheckCircle2,
Plus,
RefreshCw,
Wrench,
} from "lucide-react";
@@ -76,6 +75,7 @@ import {
} from "@/components/ui/dropdown-menu";
import { DateField } from "@/components/ui/date-field";
import { EmptyState } from "@/components/ui/empty-state";
import { QueryErrorRow } from "@/components/ui/query-error-row";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { LineChart, MoreVertical, Pencil, Trash2 } from "lucide-react";
@@ -703,23 +703,10 @@ export function VorsorgeSection({
)}
{!isLoading && isError && (
<div
role="alert"
data-slot="vorsorge-error"
className="text-muted-foreground flex flex-col items-start gap-3 py-8 text-sm sm:flex-row sm:items-center sm:justify-between"
>
<span>{t("measurementReminders.loadError")}</span>
<Button
type="button"
size="sm"
variant="outline"
onClick={() => void refetch()}
className="gap-1.5"
>
<RefreshCw className="h-3.5 w-3.5" aria-hidden="true" />
<span>{t("common.retry")}</span>
</Button>
</div>
<QueryErrorRow
message={t("measurementReminders.loadError")}
onRetry={() => void refetch()}
/>
)}
{!isLoading && !isError && (reminders?.length ?? 0) === 0 && (