UI: Fehler-States statt weißer Leerseiten bei Query-Fehlern

Dashboard/Projekt/Lead/Team/Historie rendern bei fehlgeschlagener Query nicht
mehr ein stilles `return null` (leere weisse Seite), sondern einen Hinweis mit
"Neu laden"-Button.

- Neue Komponente ErrorState (Meldung + optionaler Retry)
- 5 Routen: if (q.isError || !q.data) -> ErrorState mit q.refetch()

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Raffael SheikhandClaude Opus 4.8 committed 2026-06-07 11:35:52 +02:00
1 parent 90caa282ee
commit 8b0df9cc4e
6 files changed
+64 -5

No files matched your search

+8 -1
View File
@@ -6,6 +6,7 @@ import type { AppRouter } from '@cockpit/api/router';
import { trpc } from '../lib/trpc';
import { Card } from '../components/ui/Card';
import { SkeletonCard } from '../components/ui/SkeletonCard';
import { ErrorState } from '../components/ui/ErrorState';
type HistoryPerson = inferRouterOutputs<AppRouter>['dayEntry']['historyForDate']['entries'][number];
@@ -37,7 +38,13 @@ export function HistorieRoute() {
const q = trpc.dayEntry.historyForDate.useQuery({ date });
if (q.isPending) return <SkeletonCard lines={6} />;
if (!q.data) return null;
if (q.isError || !q.data)
return (
<ErrorState
message="Historie konnte nicht geladen werden."
onRetry={() => void q.refetch()}
/>
);
const { date: current, prevDate, nextDate, entries, ohneEintrag } = q.data;
return (