1"use client";
2
3import { QueryClient } from "@tanstack/react-query";
4import { ApiError } from "./api";
5import { DEFAULT_STALE_TIME_MS } from "./constants";
6
7
16export function makeQueryClient(): QueryClient {
17 return new QueryClient({
18 defaultOptions: {
19 queries: {
20 staleTime: DEFAULT_STALE_TIME_MS,
21 retry: (failureCount, error) => {
22
23
24 if (error instanceof ApiError) return false;
25 return failureCount < 1;
26 },
27 refetchOnWindowFocus: true
28 },
29 mutations: {
30 retry: false
31 }
32 }
33 });
34}
35