TanStackT
TanStack2y ago
3 replies
inadequate-blush

How to NOT refetch/retry failed queries?

Hello, I have some problems when fetching pararell queries. I send n number of queries and some of them might(and do) fail. The issue is that for some reason, these failed queries OCCASIONALLY get "pending" status, which is bad because I render loading state when at least one of queries is pending. In browser's network tab I see that I refetch these previously failed requests, but don't wanna do that. How can I achieve it?
useQueries({
    combine: (results) => {...},
    queries: dates.map<UseQueryOptions<SlotsSuggestionsResponse>>((date) => ({
      queryKey: [date, meeting_type, userAddress, user_id],
      queryFn: () => {
        return get_slot_suggestions(
          userAddress,
          meeting_type,
          date,
          user_id
        );
      },
      refetchOnMount: false,
      refetchOnWindowFocus: false,
      refetchOnReconnect: false,
      enabled: !!customerData && !!meeting_type && !!dates?.length,
      retry: false,
    })),
  });

What might be the cause of that?
Was this page helpful?