From 482ffe9113979d88994b2a67bad858ed382704a6 Mon Sep 17 00:00:00 2001 From: Jacob Lowe Date: Fri, 6 Dec 2024 14:35:22 -0600 Subject: [PATCH 1/3] initial defaults --- apcd_cms/src/client/src/main.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apcd_cms/src/client/src/main.tsx b/apcd_cms/src/client/src/main.tsx index ac7aaf72..175124ef 100644 --- a/apcd_cms/src/client/src/main.tsx +++ b/apcd_cms/src/client/src/main.tsx @@ -16,7 +16,15 @@ import { ExceptionFormPage } from './components/Submitter/Exceptions'; import { ExtensionRequestForm } from 'apcd-components/Submitter/Extensions'; import { ViewFileSubmissions } from './components/Submissions/ViewFileSubmissions'; -const queryClient = new QueryClient(); +const queryClient = new QueryClient({ + defaultOptions: { + queries: { + staleTime: 5 * 60 * 1000, // 5 minutes + cacheTime: 10 * 60 * 1000, // 10 minutes + refetchOnWindowFocus: false, // Disable refetching on window focus + }, + }, +}); function setupComponent(rootId: string, Component: React.ComponentType): void { const root = document.getElementById(rootId); From 055ac54612da35b9fa2be825a0f949054e0abf39 Mon Sep 17 00:00:00 2001 From: Jacob Lowe Date: Tue, 17 Dec 2024 15:02:29 -0600 Subject: [PATCH 2/3] staleTime removal --- apcd_cms/src/client/src/hooks/admin/useAdmin.ts | 2 -- apcd_cms/src/client/src/hooks/submissions/useSubmissions.ts | 1 - 2 files changed, 3 deletions(-) diff --git a/apcd_cms/src/client/src/hooks/admin/useAdmin.ts b/apcd_cms/src/client/src/hooks/admin/useAdmin.ts index 55baad2d..d6a31407 100644 --- a/apcd_cms/src/client/src/hooks/admin/useAdmin.ts +++ b/apcd_cms/src/client/src/hooks/admin/useAdmin.ts @@ -41,7 +41,6 @@ const getUsersFilters = async () => { export const useUserFilters = (): UseQueryResult => { const query = useQuery(['userfilters'], () => getUsersFilters(), { - staleTime: 5 * 60 * 1000, cacheTime: 10 * 60 * 1000, refetchOnWindowFocus: false, }) as UseQueryResult; @@ -76,7 +75,6 @@ const getSubmissionFilters = async () => { export const useSubmissionFilters = (): UseQueryResult => { const query = useQuery(['submissionFilters'], () => getSubmissionFilters(), { - staleTime: 5 * 60 * 1000, cacheTime: 10 * 60 * 1000, refetchOnWindowFocus: false, }) as UseQueryResult; diff --git a/apcd_cms/src/client/src/hooks/submissions/useSubmissions.ts b/apcd_cms/src/client/src/hooks/submissions/useSubmissions.ts index fcf259b3..5f709964 100644 --- a/apcd_cms/src/client/src/hooks/submissions/useSubmissions.ts +++ b/apcd_cms/src/client/src/hooks/submissions/useSubmissions.ts @@ -11,7 +11,6 @@ const getSubmissionFilters = async () => { export const useSubmissionFilters = (): UseQueryResult => { const query = useQuery(['submissionFilters'], () => getSubmissionFilters(), { - staleTime: 5 * 60 * 1000, cacheTime: 10 * 60 * 1000, refetchOnWindowFocus: false, }) as UseQueryResult; From 3cef5502252ab9790f6a3a4d5bf1bed5e126dc56 Mon Sep 17 00:00:00 2001 From: Jacob Lowe Date: Wed, 18 Dec 2024 16:32:13 -0600 Subject: [PATCH 3/3] config settings removal --- apcd_cms/src/client/src/hooks/admin/useAdmin.ts | 10 ++-------- .../src/client/src/hooks/submissions/useSubmissions.ts | 5 +---- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/apcd_cms/src/client/src/hooks/admin/useAdmin.ts b/apcd_cms/src/client/src/hooks/admin/useAdmin.ts index d6a31407..55d051eb 100644 --- a/apcd_cms/src/client/src/hooks/admin/useAdmin.ts +++ b/apcd_cms/src/client/src/hooks/admin/useAdmin.ts @@ -40,10 +40,7 @@ const getUsersFilters = async () => { }; export const useUserFilters = (): UseQueryResult => { - const query = useQuery(['userfilters'], () => getUsersFilters(), { - cacheTime: 10 * 60 * 1000, - refetchOnWindowFocus: false, - }) as UseQueryResult; + const query = useQuery(['userfilters'], () => getUsersFilters()) as UseQueryResult; return { ...query }; }; @@ -74,10 +71,7 @@ const getSubmissionFilters = async () => { }; export const useSubmissionFilters = (): UseQueryResult => { - const query = useQuery(['submissionFilters'], () => getSubmissionFilters(), { - cacheTime: 10 * 60 * 1000, - refetchOnWindowFocus: false, - }) as UseQueryResult; + const query = useQuery(['submissionFilters'], () => getSubmissionFilters()) as UseQueryResult; return { ...query }; }; diff --git a/apcd_cms/src/client/src/hooks/submissions/useSubmissions.ts b/apcd_cms/src/client/src/hooks/submissions/useSubmissions.ts index 5f709964..93d07a61 100644 --- a/apcd_cms/src/client/src/hooks/submissions/useSubmissions.ts +++ b/apcd_cms/src/client/src/hooks/submissions/useSubmissions.ts @@ -10,10 +10,7 @@ const getSubmissionFilters = async () => { }; export const useSubmissionFilters = (): UseQueryResult => { - const query = useQuery(['submissionFilters'], () => getSubmissionFilters(), { - cacheTime: 10 * 60 * 1000, - refetchOnWindowFocus: false, - }) as UseQueryResult; + const query = useQuery(['submissionFilters'], () => getSubmissionFilters()) as UseQueryResult; return { ...query }; };