2016-12-20 3 views
0

을 내가 수동으로 조각과 일부 graphql 데이터를 가져 오기 위해 내 네이티브 응용 프로그램을 반응에 아폴로 클라이언트를 사용하려고에 오류가 있습니다 :ApolloClient.query는 반응 네이티브

const client = new ApolloClient({ 
    networkInterface, 
}); 

const userInfo = gql ` 
    fragment UserInfo on User { 
    id 
    facebookId 
    bio 
    name { 
     full 
    } 
    } 
`; 

export const fetchUser = facebookUserId => 
    client.query(gql ` 
    { 
    user(id: "${facebookUserId}") { 
     ...${userInfo} 
    } 
    }`); 

그러나이 스택 트레이스를 제공합니다

Cannot read property 'definitions' of undefined 
TypeError: Cannot read property 'definitions' of undefined 
    at Object.getFragmentDefinitions (http://localhost:8081/index.ios.bundle?  platform=ios&dev=true&minify=false:80327:28) 
    at Object.createFragment (http://localhost:8081/index.ios.bundle? platform=ios&dev=true&minify=false:84393:38) 
    at ApolloClient.query (http://localhost:8081/index.ios.bundle? platform=ios&dev=true&minify=false:84253:13) 

나는 client.query를 잘못 사용하고 있습니까?

답변

0

쿼리 후에 조각을 추가하려고 시도 했습니까?

export const fetchUser = facebookUserId => 
    client.query(gql`query { 
    user(id: "${facebookUserId}") { 
     ... UserInfo 
    } 
    } 
    ${userInfo} 
`); 
+0

오류를 지적 해 주셔서 감사합니다. 불행히도이 문제는 해결되지 않았습니다. 나는 같은 스택 추적을 얻는다. 또한 조각을 사용하지 않고 매우 단순한 쿼리로 바꾸면 여전히 작동하지 않습니다. 그것은 클라이언트와 또 다른 문제로 보인다. –