mirror of
https://github.com/hazemKrimi/crimson-quirks-ui.git
synced 2026-05-01 18:20:28 +00:00
Add a global fetch policy config for graphql clients
This commit is contained in:
@@ -33,8 +33,7 @@ const SupportSidebar = ({ onClose }: SupportSideBarProps) => {
|
|||||||
query: GET_PROJECT_THREADS,
|
query: GET_PROJECT_THREADS,
|
||||||
variables: {
|
variables: {
|
||||||
projectId: location.pathname.split('/')[2] as string,
|
projectId: location.pathname.split('/')[2] as string,
|
||||||
},
|
}
|
||||||
fetchPolicy: 'network-only',
|
|
||||||
});
|
});
|
||||||
setProjectThreads(threads?.data?.threads!);
|
setProjectThreads(threads?.data?.threads!);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,11 +58,23 @@ const authLink = setContext((_, { headers }) => {
|
|||||||
export const clientMain = new ApolloClient({
|
export const clientMain = new ApolloClient({
|
||||||
link: authLink.concat(httpLinkMain),
|
link: authLink.concat(httpLinkMain),
|
||||||
cache: new InMemoryCache(),
|
cache: new InMemoryCache(),
|
||||||
|
defaultOptions: {
|
||||||
|
watchQuery: {
|
||||||
|
fetchPolicy: 'network-only',
|
||||||
|
nextFetchPolicy: 'cache-and-network',
|
||||||
|
},
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const clientSupport = new ApolloClient({
|
export const clientSupport = new ApolloClient({
|
||||||
link: authLink.concat(splitLink),
|
link: authLink.concat(splitLink),
|
||||||
cache: new InMemoryCache(),
|
cache: new InMemoryCache(),
|
||||||
|
defaultOptions: {
|
||||||
|
watchQuery: {
|
||||||
|
fetchPolicy: 'network-only',
|
||||||
|
nextFetchPolicy: 'cache-and-network',
|
||||||
|
},
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let root: ReactDOMClient.Root | null = null;
|
let root: ReactDOMClient.Root | null = null;
|
||||||
|
|||||||
@@ -461,8 +461,7 @@ const AddProject = () => {
|
|||||||
'country',
|
'country',
|
||||||
getCountryCode[0].country
|
getCountryCode[0].country
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
fetchPolicy: 'network-only',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const clientCreationSecurityForm = useFormik({
|
const clientCreationSecurityForm = useFormik({
|
||||||
|
|||||||
@@ -88,9 +88,7 @@ const AddTemplate = () => {
|
|||||||
const { data: categories, loading: categoriesLoading, error: categoriesError } = useQuery<
|
const { data: categories, loading: categoriesLoading, error: categoriesError } = useQuery<
|
||||||
GetAllCategoriesQuery,
|
GetAllCategoriesQuery,
|
||||||
GetAllCategoriesQueryVariables
|
GetAllCategoriesQueryVariables
|
||||||
>(GET_ALL_CATEGORIES, {
|
>(GET_ALL_CATEGORIES);
|
||||||
fetchPolicy: 'network-only',
|
|
||||||
});
|
|
||||||
|
|
||||||
const [getFeatures, { loading: featuresLoading, error: featuresError }] = useLazyQuery<
|
const [getFeatures, { loading: featuresLoading, error: featuresError }] = useLazyQuery<
|
||||||
GetAllFeaturesQuery,
|
GetAllFeaturesQuery,
|
||||||
@@ -98,8 +96,7 @@ const AddTemplate = () => {
|
|||||||
>(GET_ALL_FEATURES, {
|
>(GET_ALL_FEATURES, {
|
||||||
onCompleted({ getAllFeatures }) {
|
onCompleted({ getAllFeatures }) {
|
||||||
setAvailableFeatures(getAllFeatures);
|
setAvailableFeatures(getAllFeatures);
|
||||||
},
|
}
|
||||||
fetchPolicy: 'network-only',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const [addTemplate, { loading }] = useMutation<
|
const [addTemplate, { loading }] = useMutation<
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ const Payments = () => {
|
|||||||
>(GET_PROJECT_BY_ID, {
|
>(GET_PROJECT_BY_ID, {
|
||||||
onCompleted({ getProjectById }) {
|
onCompleted({ getProjectById }) {
|
||||||
setProject(getProjectById);
|
setProject(getProjectById);
|
||||||
},
|
}
|
||||||
fetchPolicy: 'network-only',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -61,8 +61,7 @@ const Support = () => {
|
|||||||
query: MESSAGES,
|
query: MESSAGES,
|
||||||
variables: {
|
variables: {
|
||||||
threadId: threadId!,
|
threadId: threadId!,
|
||||||
},
|
}
|
||||||
fetchPolicy: 'network-only',
|
|
||||||
});
|
});
|
||||||
setMessages(
|
setMessages(
|
||||||
Array.from(messagesResult?.data?.messages).map(
|
Array.from(messagesResult?.data?.messages).map(
|
||||||
|
|||||||
@@ -103,9 +103,7 @@ const TemplateSettings = () => {
|
|||||||
const { data: categories, loading: categoriesLoading } = useQuery<
|
const { data: categories, loading: categoriesLoading } = useQuery<
|
||||||
GetAllCategoriesQuery,
|
GetAllCategoriesQuery,
|
||||||
GetAllCategoriesQueryVariables
|
GetAllCategoriesQueryVariables
|
||||||
>(GET_ALL_CATEGORIES, {
|
>(GET_ALL_CATEGORIES);
|
||||||
fetchPolicy: 'network-only',
|
|
||||||
});
|
|
||||||
|
|
||||||
const [getFeatures, { loading: featuresLoading }] = useLazyQuery<
|
const [getFeatures, { loading: featuresLoading }] = useLazyQuery<
|
||||||
GetAllFeaturesQuery,
|
GetAllFeaturesQuery,
|
||||||
@@ -113,8 +111,7 @@ const TemplateSettings = () => {
|
|||||||
>(GET_ALL_FEATURES, {
|
>(GET_ALL_FEATURES, {
|
||||||
onCompleted({ getAllFeatures }) {
|
onCompleted({ getAllFeatures }) {
|
||||||
setAvailableFeatures(getAllFeatures);
|
setAvailableFeatures(getAllFeatures);
|
||||||
},
|
}
|
||||||
fetchPolicy: 'network-only',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const [getTemplate, { loading: templateLoading }] = useLazyQuery<
|
const [getTemplate, { loading: templateLoading }] = useLazyQuery<
|
||||||
@@ -123,8 +120,7 @@ const TemplateSettings = () => {
|
|||||||
>(GET_TEMPLATE_BY_ID, {
|
>(GET_TEMPLATE_BY_ID, {
|
||||||
onCompleted({ getTemplateById }) {
|
onCompleted({ getTemplateById }) {
|
||||||
setTemplate(getTemplateById);
|
setTemplate(getTemplateById);
|
||||||
},
|
}
|
||||||
fetchPolicy: 'network-only',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const [updateTemplate, { loading }] = useMutation<
|
const [updateTemplate, { loading }] = useMutation<
|
||||||
|
|||||||
@@ -46,8 +46,7 @@ const Users = () => {
|
|||||||
? 'ProductOwner'
|
? 'ProductOwner'
|
||||||
: 'Developer';
|
: 'Developer';
|
||||||
setUsers(getAllUsers.filter((user) => user.role === userRole));
|
setUsers(getAllUsers.filter((user) => user.role === userRole));
|
||||||
},
|
}
|
||||||
fetchPolicy: 'network-only',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user