diff --git a/src/components/illness/illness-episode-detail.tsx b/src/components/illness/illness-episode-detail.tsx
index 9bd0dc346..55f87541e 100644
--- a/src/components/illness/illness-episode-detail.tsx
+++ b/src/components/illness/illness-episode-detail.tsx
@@ -13,6 +13,7 @@ import { useState } from "react";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Card, CardContent } from "@/components/ui/card";
+import { QueryErrorCard } from "@/components/ui/query-error-card";
import { Skeleton } from "@/components/ui/skeleton";
import { useTranslations, useFormatters } from "@/lib/i18n/context";
@@ -35,7 +36,12 @@ function todayLocal(): string {
export function IllnessEpisodeDetail({ episodeId }: { episodeId: string }) {
const { t } = useTranslations();
const fmt = useFormatters();
- const { data: episode, isLoading, isError } = useIllnessEpisode(episodeId);
+ const {
+ data: episode,
+ isLoading,
+ isError,
+ refetch,
+ } = useIllnessEpisode(episodeId);
const resolve = useResolveEpisode();
const [logOpen, setLogOpen] = useState(false);
@@ -44,9 +50,10 @@ export function IllnessEpisodeDetail({ episodeId }: { episodeId: string }) {
if (isError) {
return (
-
- {t("illness.loadError")}
-
+ void refetch()}
+ />
);
}
diff --git a/src/components/labs/biomarker-manager.tsx b/src/components/labs/biomarker-manager.tsx
index 8608c0a8c..f2f024393 100644
--- a/src/components/labs/biomarker-manager.tsx
+++ b/src/components/labs/biomarker-manager.tsx
@@ -8,6 +8,7 @@ import { toast } from "sonner";
import { DeleteButton } from "@/components/data-list";
import { Button } from "@/components/ui/button";
import { EmptyState } from "@/components/ui/empty-state";
+import { QueryErrorCard } from "@/components/ui/query-error-card";
import { ResponsiveSheet } from "@/components/ui/responsive-sheet";
import { Skeleton } from "@/components/ui/skeleton";
import { apiDelete, apiGet, apiPut } from "@/lib/api/api-fetch";
@@ -40,7 +41,7 @@ export function BiomarkerManager() {
const [editing, setEditing] = useState(null);
const [formFooterEl, setFormFooterEl] = useState(null);
- const { data, isLoading, isError } = useQuery({
+ const { data, isLoading, isError, refetch } = useQuery({
queryKey: queryKeys.biomarkers(),
queryFn: () => apiGet("/api/biomarkers"),
});
@@ -174,9 +175,10 @@ export function BiomarkerManager() {
))}
) : isError ? (
-
- {t("labs.biomarker.loadError")}
-
+ void refetch()}
+ />
) : markers.length === 0 ? (
}
diff --git a/src/components/labs/lab-biomarker-detail.tsx b/src/components/labs/lab-biomarker-detail.tsx
index 3b420d5d6..3c009438a 100644
--- a/src/components/labs/lab-biomarker-detail.tsx
+++ b/src/components/labs/lab-biomarker-detail.tsx
@@ -16,6 +16,7 @@ import { DeleteButton } from "@/components/data-list";
import { Button } from "@/components/ui/button";
import { Card, CardContent } from "@/components/ui/card";
import { EmptyState } from "@/components/ui/empty-state";
+import { QueryErrorCard } from "@/components/ui/query-error-card";
import { ResponsiveSheet } from "@/components/ui/responsive-sheet";
import { Skeleton } from "@/components/ui/skeleton";
import { InsightStatusCard } from "@/components/insights/insight-status-card";
@@ -248,21 +249,13 @@ export function LabBiomarkerDetail({ biomarkerId }: { biomarkerId: string }) {
{description}
-
-
- {t("labs.loadError")}
-
-
-
+ {
+ if (markerError) void refetchMarker();
+ if (listError) void refetchList();
+ }}
+ />
);
}
diff --git a/src/components/labs/lab-values-list.tsx b/src/components/labs/lab-values-list.tsx
index c391ed8bf..0040e896d 100644
--- a/src/components/labs/lab-values-list.tsx
+++ b/src/components/labs/lab-values-list.tsx
@@ -5,6 +5,7 @@ import { useInfiniteQuery } from "@tanstack/react-query";
import { Button } from "@/components/ui/button";
import { Card, CardContent } from "@/components/ui/card";
+import { QueryErrorCard } from "@/components/ui/query-error-card";
import { Skeleton } from "@/components/ui/skeleton";
import { apiGet } from "@/lib/api/api-fetch";
import { useTranslations } from "@/lib/i18n/context";
@@ -33,6 +34,7 @@ export function LabValuesList({ biomarkerId }: { biomarkerId: string }) {
data: list,
isLoading,
isError,
+ refetch,
fetchNextPage,
hasNextPage,
isFetchingNextPage,
@@ -60,9 +62,10 @@ export function LabValuesList({ biomarkerId }: { biomarkerId: string }) {
if (isError) {
return (
-
- {t("labs.loadError")}
-
+ void refetch()}
+ />
);
}
diff --git a/src/components/medications/intake-history-list-v2.tsx b/src/components/medications/intake-history-list-v2.tsx
index eb7f17fd5..7cf66557b 100644
--- a/src/components/medications/intake-history-list-v2.tsx
+++ b/src/components/medications/intake-history-list-v2.tsx
@@ -28,6 +28,7 @@ import {
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { EmptyState } from "@/components/ui/empty-state";
+import { QueryErrorCard } from "@/components/ui/query-error-card";
import {
Table,
TableBody,
@@ -172,7 +173,7 @@ export function IntakeHistoryListV2({
const offset = page * pageSize;
- const { data, isLoading, isError } = useQuery({
+ const { data, isLoading, isError, refetch } = useQuery({
queryKey: queryKeys.medicationIntakeList(medicationId, {
sortBy,
sortDir,
@@ -243,9 +244,10 @@ export function IntakeHistoryListV2({
) : isError ? (
-
- {t("medications.loadFailed")}
-
+ void refetch()}
+ />
) : events.length === 0 ? (
(null);
const [formFooterEl, setFormFooterEl] = useState(null);
- const { data, isLoading, isError } = useQuery({
+ const { data, isLoading, isError, refetch } = useQuery({
queryKey: queryKeys.allergyList(true),
queryFn: () => apiGet("/api/allergies"),
});
@@ -135,9 +136,10 @@ export function AllergyManager() {
))}
) : isError ? (
-
- {t("records.allergies.loadError")}
-
+ void refetch()}
+ />
) : rows.length === 0 ? (
}
diff --git a/src/components/records/conditions-manager.tsx b/src/components/records/conditions-manager.tsx
index 686a5dfa1..dea120160 100644
--- a/src/components/records/conditions-manager.tsx
+++ b/src/components/records/conditions-manager.tsx
@@ -28,6 +28,7 @@ import { toast } from "sonner";
import { Button } from "@/components/ui/button";
import { Label } from "@/components/ui/label";
+import { QueryErrorCard } from "@/components/ui/query-error-card";
import { useTranslations } from "@/lib/i18n/context";
import { queryKeys } from "@/lib/query-keys";
import { cn } from "@/lib/utils";
@@ -126,9 +127,10 @@ export function ConditionsManager() {
return (
{query.isError ? (
-
- {t("records.conditions.loadError")}
-
+
void query.refetch()}
+ />
) : (
<>
{field(
diff --git a/src/components/records/family-history-manager.tsx b/src/components/records/family-history-manager.tsx
index 545038850..4a6cb7542 100644
--- a/src/components/records/family-history-manager.tsx
+++ b/src/components/records/family-history-manager.tsx
@@ -8,6 +8,7 @@ import { toast } from "sonner";
import { DeleteButton } from "@/components/data-list";
import { Button } from "@/components/ui/button";
import { EmptyState } from "@/components/ui/empty-state";
+import { QueryErrorCard } from "@/components/ui/query-error-card";
import { ResponsiveSheet } from "@/components/ui/responsive-sheet";
import { Skeleton } from "@/components/ui/skeleton";
import { apiDelete, apiGet } from "@/lib/api/api-fetch";
@@ -30,7 +31,7 @@ export function FamilyHistoryManager() {
const [editing, setEditing] = useState(null);
const [formFooterEl, setFormFooterEl] = useState(null);
- const { data, isLoading, isError } = useQuery({
+ const { data, isLoading, isError, refetch } = useQuery({
queryKey: queryKeys.familyHistoryList(),
queryFn: () => apiGet("/api/family-history"),
});
@@ -120,9 +121,10 @@ export function FamilyHistoryManager() {
))}
) : isError ? (
-
- {t("records.family.loadError")}
-
+ void refetch()}
+ />
) : rows.length === 0 ? (
}