mirror of
https://github.com/ershisan99/podcaster.git
synced 2025-12-18 12:33:48 +00:00
feat: add idb persister to cache requests for 24 hours
This commit is contained in:
13
src/app.tsx
13
src/app.tsx
@@ -1,5 +1,7 @@
|
||||
import { Router } from "./router";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { QueryClient } from "@tanstack/react-query";
|
||||
import { createIDBPersister } from "./services/infrastructure/persisters/create-idb-persister";
|
||||
import { PersistQueryClientProvider } from "@tanstack/react-query-persist-client";
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
@@ -7,14 +9,19 @@ const queryClient = new QueryClient({
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnMount: false,
|
||||
retry: false,
|
||||
gcTime: 1000 * 60 * 60 * 24, // 24 hours
|
||||
},
|
||||
},
|
||||
});
|
||||
const persister = createIDBPersister();
|
||||
|
||||
export function App() {
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<PersistQueryClientProvider
|
||||
client={queryClient}
|
||||
persistOptions={{ persister }}
|
||||
>
|
||||
<Router />
|
||||
</QueryClientProvider>
|
||||
</PersistQueryClientProvider>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user