fix: use cache-and-network fetchPolicy for consistency
This commit is contained in:
@@ -10,7 +10,12 @@ type CreateClientOptions = {
|
|||||||
|
|
||||||
const client = new ApolloClient({
|
const client = new ApolloClient({
|
||||||
cache,
|
cache,
|
||||||
link: createLink({ uri: appConfig.graphqlUrl })
|
link: createLink({ uri: appConfig.graphqlUrl }),
|
||||||
|
defaultOptions: {
|
||||||
|
watchQuery: {
|
||||||
|
fetchPolicy: 'cache-and-network',
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export function mutateAndGetClient(options: CreateClientOptions): typeof client {
|
export function mutateAndGetClient(options: CreateClientOptions): typeof client {
|
||||||
|
@@ -4,7 +4,7 @@ import { IUser } from '@automatisch/types';
|
|||||||
import { GET_CURRENT_USER } from 'graphql/queries/get-current-user';
|
import { GET_CURRENT_USER } from 'graphql/queries/get-current-user';
|
||||||
|
|
||||||
export default function useCurrentUser(): IUser {
|
export default function useCurrentUser(): IUser {
|
||||||
const { data } = useQuery(GET_CURRENT_USER, { fetchPolicy: 'cache-and-network' });
|
const { data } = useQuery(GET_CURRENT_USER);
|
||||||
|
|
||||||
return data?.getCurrentUser;
|
return data?.getCurrentUser;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user