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