diff --git a/src/components/SupportSidebar/index.tsx b/src/components/SupportSidebar/index.tsx index 81abd7a..2c80375 100644 --- a/src/components/SupportSidebar/index.tsx +++ b/src/components/SupportSidebar/index.tsx @@ -33,8 +33,7 @@ const SupportSidebar = ({ onClose }: SupportSideBarProps) => { query: GET_PROJECT_THREADS, variables: { projectId: location.pathname.split('/')[2] as string, - }, - fetchPolicy: 'network-only', + } }); setProjectThreads(threads?.data?.threads!); } diff --git a/src/index.tsx b/src/index.tsx index 60069ab..cd93795 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -58,11 +58,23 @@ const authLink = setContext((_, { headers }) => { export const clientMain = new ApolloClient({ link: authLink.concat(httpLinkMain), cache: new InMemoryCache(), + defaultOptions: { + watchQuery: { + fetchPolicy: 'network-only', + nextFetchPolicy: 'cache-and-network', + }, + } }); export const clientSupport = new ApolloClient({ link: authLink.concat(splitLink), cache: new InMemoryCache(), + defaultOptions: { + watchQuery: { + fetchPolicy: 'network-only', + nextFetchPolicy: 'cache-and-network', + }, + } }); let root: ReactDOMClient.Root | null = null; diff --git a/src/pages/AddProject/index.tsx b/src/pages/AddProject/index.tsx index d4a9b9b..c07069b 100644 --- a/src/pages/AddProject/index.tsx +++ b/src/pages/AddProject/index.tsx @@ -461,8 +461,7 @@ const AddProject = () => { 'country', getCountryCode[0].country ); - }, - fetchPolicy: 'network-only', + } }); const clientCreationSecurityForm = useFormik({ diff --git a/src/pages/AddTemplate/index.tsx b/src/pages/AddTemplate/index.tsx index 1cb24a1..db16a49 100644 --- a/src/pages/AddTemplate/index.tsx +++ b/src/pages/AddTemplate/index.tsx @@ -88,9 +88,7 @@ const AddTemplate = () => { const { data: categories, loading: categoriesLoading, error: categoriesError } = useQuery< GetAllCategoriesQuery, GetAllCategoriesQueryVariables - >(GET_ALL_CATEGORIES, { - fetchPolicy: 'network-only', - }); + >(GET_ALL_CATEGORIES); const [getFeatures, { loading: featuresLoading, error: featuresError }] = useLazyQuery< GetAllFeaturesQuery, @@ -98,8 +96,7 @@ const AddTemplate = () => { >(GET_ALL_FEATURES, { onCompleted({ getAllFeatures }) { setAvailableFeatures(getAllFeatures); - }, - fetchPolicy: 'network-only', + } }); const [addTemplate, { loading }] = useMutation< diff --git a/src/pages/Payments/index.tsx b/src/pages/Payments/index.tsx index 20f69dc..85fcbf2 100644 --- a/src/pages/Payments/index.tsx +++ b/src/pages/Payments/index.tsx @@ -49,8 +49,7 @@ const Payments = () => { >(GET_PROJECT_BY_ID, { onCompleted({ getProjectById }) { setProject(getProjectById); - }, - fetchPolicy: 'network-only', + } }); useEffect(() => { diff --git a/src/pages/Support/index.tsx b/src/pages/Support/index.tsx index d37b720..005cdc4 100644 --- a/src/pages/Support/index.tsx +++ b/src/pages/Support/index.tsx @@ -61,8 +61,7 @@ const Support = () => { query: MESSAGES, variables: { threadId: threadId!, - }, - fetchPolicy: 'network-only', + } }); setMessages( Array.from(messagesResult?.data?.messages).map( diff --git a/src/pages/TemplateSettings/index.tsx b/src/pages/TemplateSettings/index.tsx index 4b83f18..46bd936 100644 --- a/src/pages/TemplateSettings/index.tsx +++ b/src/pages/TemplateSettings/index.tsx @@ -103,9 +103,7 @@ const TemplateSettings = () => { const { data: categories, loading: categoriesLoading } = useQuery< GetAllCategoriesQuery, GetAllCategoriesQueryVariables - >(GET_ALL_CATEGORIES, { - fetchPolicy: 'network-only', - }); + >(GET_ALL_CATEGORIES); const [getFeatures, { loading: featuresLoading }] = useLazyQuery< GetAllFeaturesQuery, @@ -113,8 +111,7 @@ const TemplateSettings = () => { >(GET_ALL_FEATURES, { onCompleted({ getAllFeatures }) { setAvailableFeatures(getAllFeatures); - }, - fetchPolicy: 'network-only', + } }); const [getTemplate, { loading: templateLoading }] = useLazyQuery< @@ -123,8 +120,7 @@ const TemplateSettings = () => { >(GET_TEMPLATE_BY_ID, { onCompleted({ getTemplateById }) { setTemplate(getTemplateById); - }, - fetchPolicy: 'network-only', + } }); const [updateTemplate, { loading }] = useMutation< diff --git a/src/pages/Users/index.tsx b/src/pages/Users/index.tsx index 92bf162..fccfe85 100644 --- a/src/pages/Users/index.tsx +++ b/src/pages/Users/index.tsx @@ -46,8 +46,7 @@ const Users = () => { ? 'ProductOwner' : 'Developer'; setUsers(getAllUsers.filter((user) => user.role === userRole)); - }, - fetchPolicy: 'network-only', + } }); useEffect(() => {