0
Ich versuche, die apollo-Client verwenden in meiner reagieren native App manuell einige graphql Daten mit einem Fragment zu holen:ApolloClient.query mit Fragment gibt Fehler auf reagieren-native
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}
}
}`);
Aber das gibt diesem Stacktrace:
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)
Ich benutze die client.query falsch?
Vielen Dank für den Hinweis auf diesen Fehler. Leider hat es das Problem nicht behoben. Ich bekomme den gleichen Stacktrace. Auch wenn ich die Abfrage durch etwas sehr einfaches ohne das Fragment ersetze, funktioniert es immer noch nicht. Es scheint ein anderes Problem mit dem Kunden. –