Files
big-agi/src/common/app.queryclient.ts
T
2024-08-01 23:10:30 -07:00

25 lines
635 B
TypeScript

import { QueryClient } from '@tanstack/react-query';
let queryClient: QueryClient | null = null;
export function reactQueryClientSingleton(): QueryClient {
if (!queryClient) {
queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: false,
// call functions even when the network is disconnected; this makes 127.0.0.1 work, while probably not causing other issues
networkMode: 'always',
refetchOnWindowFocus: false,
},
mutations: {
retry: false,
networkMode: 'always',
},
},
});
}
return queryClient;
}