TanStackT
TanStack17mo ago
58 replies
dual-salmon

Long waiting time for queryFn to run

Hi,

I'm experiencing a strange issue with react-query. When the useQuery function is mounted, and I can see it registered in the devtools, it takes several milliseconds (1500 - 3400) to run queryFn.

My code:
    const { data, refetch } = useQuery<Stop>({
        queryKey: ["stop", city, stop],
        queryFn: () => fetchStop(city, stop, limit),
    });


and queryClient options:
const queryClient = new QueryClient({
    defaultOptions: {
        queries: {
            refetchOnMount: true,
            refetchOnWindowFocus: false,
            refetchOnReconnect: false,
        },
    },
});
Was this page helpful?