fix(insights): count failed fetches toward a bounded poll's ceiling

The status and advisor polls counted attempts on dataUpdateCount, which a
failed fetch does not move, while the last good payload stayed in place and
still said preparing. A request that kept failing polled an open page for
as long as it stayed open. Attempts now include the failed fetches.

The poll inventory moves from a comment into a guard held to every
refetchInterval in the tree; four polls were missing from the comment.
This commit is contained in:
Marc-André Bombeck committed 2026-10-20 10:06:11 +02:00
1 parent b12bece491
commit 985372f711
7 files changed
+282 -48

No files matched your search

+2 -1
View File
@@ -7,6 +7,7 @@ import { Loader2, Pill } from "lucide-react";
import { useAiCapability } from "@/hooks/use-ai-capability";
import { useAuth } from "@/hooks/use-auth";
import { nextStatusPollInterval } from "@/hooks/use-insight-status";
import { pollAttemptCount } from "@/lib/queries/refetch-interval";
import { queryKeys } from "@/lib/query-keys";
import { useTranslations } from "@/lib/i18n/context";
import { Badge } from "@/components/ui/badge";
@@ -142,7 +143,7 @@ export default function InsightsMedikamentePage() {
refetchInterval: (query) =>
nextStatusPollInterval(
query.state.data?.preparing,
query.state.dataUpdateCount,
pollAttemptCount(query.state),
query.state.data?.revalidating,
),
});