feat(21-04): add subscription error handling with toast feedback on all pages
- Replace silent onError: () => {} with sticky toast notification
- Toast uses fixed ID 'sub-error' to prevent duplicate notifications
- duration: Infinity keeps toast visible until dismissed
- Applied to initiatives/index.tsx, initiatives/$id.tsx, inbox.tsx
This commit is contained in:
@@ -3,6 +3,7 @@ import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
import { AlertCircle } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Skeleton } from "@/components/Skeleton";
|
||||
import { toast } from "sonner";
|
||||
import { trpc } from "@/lib/trpc";
|
||||
import { InitiativeHeader } from "@/components/InitiativeHeader";
|
||||
import { ProgressPanel } from "@/components/ProgressPanel";
|
||||
@@ -218,13 +219,23 @@ function InitiativeDetailPage() {
|
||||
void utils.listTasks.invalidate();
|
||||
void utils.listPlans.invalidate();
|
||||
},
|
||||
onError: () => {},
|
||||
onError: () => {
|
||||
toast.error("Live updates disconnected. Refresh to reconnect.", {
|
||||
id: "sub-error",
|
||||
duration: Infinity,
|
||||
});
|
||||
},
|
||||
});
|
||||
trpc.onAgentUpdate.useSubscription(undefined, {
|
||||
onData: () => {
|
||||
void utils.listAgents.invalidate();
|
||||
},
|
||||
onError: () => {},
|
||||
onError: () => {
|
||||
toast.error("Live updates disconnected. Refresh to reconnect.", {
|
||||
id: "sub-error",
|
||||
duration: Infinity,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
// State
|
||||
|
||||
Reference in New Issue
Block a user