From 792d0f3db62f4b38a550cd82f92d13b322bd2fcf Mon Sep 17 00:00:00 2001 From: SagarRajput-7 <162284829+SagarRajput-7@users.noreply.github.com> Date: Fri, 19 Sep 2025 10:55:19 +0530 Subject: [PATCH] fix: removed staleTime and cacheTime from query client level (#9124) * fix: removed staleTime for dashboard API, to fetch fresh data while switching between dashboards * fix: removed query client level staleTime and cacheTime * fix: adding dashbaordID to the query key * fix: removed unnecessary query key --- frontend/src/index.tsx | 2 -- frontend/src/providers/Dashboard/Dashboard.tsx | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx index 7cb99ad0761a..25cfbfb5abaa 100644 --- a/frontend/src/index.tsx +++ b/frontend/src/index.tsx @@ -16,8 +16,6 @@ const queryClient = new QueryClient({ defaultOptions: { queries: { refetchOnWindowFocus: false, - staleTime: 2 * 60 * 1000, // 2 minutes - data becomes stale after 2 minutes - cacheTime: 5 * 60 * 1000, // 5 minutes - cache entries are garbage collected after 5 minutes retry(failureCount, error): boolean { if ( // in case of manually throwing errors please make sure to send error.response.status diff --git a/frontend/src/providers/Dashboard/Dashboard.tsx b/frontend/src/providers/Dashboard/Dashboard.tsx index a51ac9439f42..395858b77b8f 100644 --- a/frontend/src/providers/Dashboard/Dashboard.tsx +++ b/frontend/src/providers/Dashboard/Dashboard.tsx @@ -269,7 +269,7 @@ export function DashboardProvider({ return data; }; const dashboardResponse = useQuery( - [REACT_QUERY_KEY.DASHBOARD_BY_ID, isDashboardPage?.params], + [REACT_QUERY_KEY.DASHBOARD_BY_ID, dashboardId], { enabled: (!!isDashboardPage || !!isDashboardWidgetPage) && isLoggedIn, queryFn: async () => {