I am writing a UI application in reactjs and want to get data to render using graphql. I am using Relay for the same. However, the graphql query I built in Relay.createContainer is adding extra "id" field. Is there a way in relay/graphql to exclude these unnecessary fields, and include only what is given in query while creating. Below is the code snippet: In RelayRoute.jsx::
TPRelayRoute.queries = {
enterprise: () => {
return Relay.QL`
query etp_ptp{
enterprise
}`;
}
};
In UITable.jsx::
export default Relay.createContainer(UITable, {
initialVariables: {
count: 20
},
fragments: {
enterprise: () => {
return Relay.QL`
fragment etp on Enterprise {
etpInfo{
erInfo{
payments(first:$count){
edges{
node{
enterprise{
id
}
}
}
}
}
}
}`;
}
}
});
Query which is being sent: {"query":"query etp_ptp {enterprise {id,...F0}} fragment F0 on Enterprise {etpInfo {erInfo {paymentsEEVLi:payments(first:20) {edges {node {enterprise{id,__typename},id,__typename},cursor},pageInfo {hasNextPage,hasPreviousPage}}}},id}","variables":{}}
Query expected to be sent: {"query":"query etp_ptp {enterprise {...F0}} fragment F0 on Enterprise {etpInfo {erInfo {payments(first:20) {edges {node {enterprise{id,__typename},id,__typename},cursor},pageInfo {hasNextPage,hasPreviousPage}}}}}","variables":{}}