aboutsummaryrefslogtreecommitdiff
path: root/apps/browser-extension/utils/query-client.ts
blob: ba21c058b837a5ea42dac00af03bd75acce14778 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
 * React Query configuration for supermemory browser extension
 */
import { QueryClient } from "@tanstack/react-query"

export const queryClient = new QueryClient({
	defaultOptions: {
		queries: {
			staleTime: 5 * 60 * 1000, // 5 minutes
			gcTime: 10 * 60 * 1000, // 10 minutes (previously cacheTime)
			retry: (failureCount, error) => {
				// Don't retry on authentication errors
				if (error?.constructor?.name === "AuthenticationError") {
					return false
				}
				return failureCount < 3
			},
			refetchOnMount: true,
			refetchOnWindowFocus: false,
		},
		mutations: {
			retry: 1,
		},
	},
})