1
- import { useCallback , useEffect , useState } from 'react' ;
1
+ import { useCallback , useEffect , useState } from 'react' ;
2
2
import {
3
3
ApolloClient ,
4
4
InMemoryCache ,
5
5
NormalizedCacheObject ,
6
6
createHttpLink ,
7
7
} from '@apollo/client' ;
8
- import { AsyncStorageWrapper , CachePersistor } from 'apollo3-cache-persist' ;
8
+ import { AsyncStorageWrapper , CachePersistor } from 'apollo3-cache-persist' ;
9
9
import AsyncStorage from '@react-native-async-storage/async-storage' ;
10
10
11
- import { persistenceMapper , createPersistLink } from '../utils/persistence' ;
11
+ import { persistenceMapper , createPersistLink } from '../utils/persistence' ;
12
12
13
13
export const useApolloClient = ( ) => {
14
14
const [ client , setClient ] = useState < ApolloClient < NormalizedCacheObject > > ( ) ;
@@ -27,8 +27,6 @@ export const useApolloClient = () => {
27
27
const cache = new InMemoryCache ( ) ;
28
28
let newPersistor = new CachePersistor ( {
29
29
cache,
30
- // https://github.com/apollographql/apollo-cache-persist/issues/426
31
- // @ts -ignore
32
30
storage : new AsyncStorageWrapper ( AsyncStorage ) ,
33
31
debug : __DEV__ ,
34
32
trigger : 'write' ,
@@ -37,7 +35,7 @@ export const useApolloClient = () => {
37
35
await newPersistor . restore ( ) ;
38
36
setPersistor ( newPersistor ) ;
39
37
const persistLink = createPersistLink ( ) ;
40
- const httpLink = createHttpLink ( { uri : 'https://api.spacex.land/graphql' } ) ;
38
+ const httpLink = createHttpLink ( { uri : 'https://api.spacex.land/graphql' } ) ;
41
39
setClient (
42
40
new ApolloClient ( {
43
41
link : persistLink . concat ( httpLink ) ,
0 commit comments