Fix AI suggestions query running twice
Build and Push Docker Image / build (push) Successful in 9m8s Details

Disable automatic refetching for expensive AI assignment query:
- Set staleTime to Infinity (never auto-refetch)
- Disable refetchOnWindowFocus, refetchOnReconnect, refetchOnMount
- Only manual refresh via button will trigger new request

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Matt 2026-02-04 17:19:20 +01:00
parent c45a428d8b
commit 148925cb95
1 changed files with 8 additions and 2 deletions

View File

@ -89,10 +89,16 @@ function AssignmentManagementContent({ roundId }: { roundId: string }) {
{ enabled: !!round && !useAI } { enabled: !!round && !useAI }
) )
// AI-powered suggestions // AI-powered suggestions (expensive - disable auto refetch)
const { data: aiSuggestionsRaw, isLoading: loadingAI, refetch: refetchAI } = trpc.assignment.getAISuggestions.useQuery( const { data: aiSuggestionsRaw, isLoading: loadingAI, refetch: refetchAI } = trpc.assignment.getAISuggestions.useQuery(
{ roundId, useAI: true }, { roundId, useAI: true },
{ enabled: !!round && useAI } {
enabled: !!round && useAI,
staleTime: Infinity, // Never consider stale (only refetch manually)
refetchOnWindowFocus: false,
refetchOnReconnect: false,
refetchOnMount: false,
}
) )
// Normalize AI suggestions to match algorithmic format // Normalize AI suggestions to match algorithmic format