Typically, creating an object Relay queryfor queries with one definition can be done with:
const relayQuery = Relay.QL `
query UserRoute($id_0: ID!) {
user(id:$id_0) {
id,
name,
email
}
}
;
I have a query string intercepted from one that is sent over the network. Usually they have several definitions (for example, request, fragment, mutation, subscription). I want to create Relay query objectfor this type of request. The following code throws an error:
Relay transform error "You supplied a GraphQL document named 'network' with 2 definitions, but it must have exactly one definition." in file '/Users/ankitshah/lyearnapp/src/network.js'. Try updating your GraphQL schema if an argument/field/type was recently added.
for this code:
const relayQuery = Relay.QL `
query UserRoute($id_0: ID!) {
user(id:$id_0) {
id,
...F0
}
}
fragment F0 on User {
id,
name,
email
}
;
I need this because I want to update the relay store using a function Relay.Store.getStoreData().updateQueryPayload(queryObject, payload). Any help is appreciated.
source
share