From 473ba2e36723c5e94ab87f3440917cc3a3201f73 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Thu, 13 Jul 2023 11:21:12 +0100 Subject: [PATCH] feat: set react-query cache time --- src/lib/query-client.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lib/query-client.ts b/src/lib/query-client.ts index a4a512ac..2c7f5ed6 100644 --- a/src/lib/query-client.ts +++ b/src/lib/query-client.ts @@ -2,5 +2,16 @@ import { cache } from "react" import { QueryClient } from "@tanstack/react-query" -const getQueryClient = cache(() => new QueryClient()) +const getQueryClient = cache( + () => + new QueryClient({ + defaultOptions: { + queries: { + staleTime: 5 * 1000, + cacheTime: 60 * 1000, + }, + }, + }), +) + export default getQueryClient