feat: use ApolloFactory for metadata client (#4608)

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Jérémy M
2024-03-25 19:15:46 +01:00
committed by GitHub
parent d2b237ebf2
commit d1ab063000
2 changed files with 8 additions and 22 deletions

View File

@ -11,9 +11,9 @@ import { useIsMatchingLocation } from '~/hooks/useIsMatchingLocation';
import { useUpdateEffect } from '~/hooks/useUpdateEffect';
import { isDefined } from '~/utils/isDefined';
import { ApolloFactory } from '../services/apollo.factory';
import { ApolloFactory, Options } from '../services/apollo.factory';
export const useApolloFactory = () => {
export const useApolloFactory = (options: Partial<Options<any>> = {}) => {
// eslint-disable-next-line @nx/workspace-no-state-useref
const apolloRef = useRef<ApolloFactory<NormalizedCacheObject> | null>(null);
const [isDebugMode] = useRecoilState(isDebugModeState);
@ -50,6 +50,8 @@ export const useApolloFactory = () => {
},
extraLinks: [],
isDebugMode,
// Override options
...options,
});
return apolloRef.current.getClient();