perf: Remove preview polling in favour of SSE-driven invalidation

refetchInterval: 3000 on listPreviews and getPreviewStatus is now
redundant. Phase oMHtTekCDgdnBG0kkk25A wired useLiveUpdates in
$id.tsx to invalidate both queries on every preview:* SSE event,
so queries refetch exactly once per state change instead of on
a fixed 3-second timer.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lukas May
2026-03-05 21:17:00 +01:00
parent 5ccf4ae556
commit 7bc1e7f25b

View File

@@ -80,7 +80,6 @@ export function ReviewTab({ initiativeId }: ReviewTabProps) {
// Preview state
const previewsQuery = trpc.listPreviews.useQuery(
{ initiativeId },
{ refetchInterval: 3000 },
);
const existingPreview = previewsQuery.data?.find(
(p) => p.phaseId === activePhaseId || p.initiativeId === initiativeId,
@@ -90,7 +89,6 @@ export function ReviewTab({ initiativeId }: ReviewTabProps) {
{ previewId: activePreviewId ?? existingPreview?.id ?? "" },
{
enabled: !!(activePreviewId ?? existingPreview?.id),
refetchInterval: 3000,
},
);
const preview = previewStatusQuery.data ?? existingPreview;