Skip to content

Commit 7e9b77e

Browse files
committed
fix: surface the error state instead of "No results." when the log query fails
The loading branch added in the previous commit split the fallback cell two ways: spinner while in flight, "No results." otherwise. That second branch also catches the failure case -- when readStatsLogs errors, statsLogs stays undefined and isLoading goes false, so a failed request renders as a successful empty response. The query's isError/error were not destructured. The cell now branches three ways and reports the error through AlertBlock, matching how ShowTraefikSystem surfaces a failed readDirectories query.
1 parent 6204415 commit 7e9b77e

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎apps/dokploy/components/dashboard/requests/requests-table.tsx‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
} from "lucide-react";
2424
import { useMemo, useState } from "react";
2525
import { toast } from "sonner";
26+
import { AlertBlock } from "@/components/shared/alert-block";
2627
import { Badge } from "@/components/ui/badge";
2728
import { Button } from "@/components/ui/button";
2829
import {
@@ -101,7 +102,12 @@ export const RequestsTable = ({ dateRange }: RequestsTableProps) => {
101102
pageSize: 10,
102103
});
103104

104-
const { data: statsLogs, isLoading } = api.settings.readStatsLogs.useQuery(
105+
const {
106+
data: statsLogs,
107+
isLoading,
108+
isError,
109+
error,
110+
} = api.settings.readStatsLogs.useQuery(
105111
{
106112
sort: sorting[0],
107113
page: pagination,
@@ -279,6 +285,12 @@ export const RequestsTable = ({ dateRange }: RequestsTableProps) => {
279285
<Loader2 className="size-4 animate-spin" />
280286
<span>Loading requests...</span>
281287
</div>
288+
) : isError ? (
289+
<div className="w-full flex items-center justify-center h-[55vh]">
290+
<AlertBlock type="error" className="w-full">
291+
{error?.message}
292+
</AlertBlock>
293+
</div>
282294
) : (
283295
<div className="w-full flex-col gap-2 flex items-center justify-center h-[55vh]">
284296
<span className="text-muted-foreground text-lg font-medium">

0 commit comments

Comments
 (0)