I am working on a React application and I am facing an issue with Apollo client (@apollo/client 3.3.6)
. I am not sure if I am missing some configurations or what.
For a query, Apollo client somehow transforms my response i.e., the response that useLazyQuery
returns is different that what I can see in Chrome's Network tab.
Network tab is showing the following response:
However when I print response, it is:
{
"getProjectSetById": {
"data": {
"id": "3d8f3b49-5764-4da6-a9c4-5db0f2904242",
"name": "New Project Set Name",
"description": "Kashif's project set",
"projectSetType": {
"id": "STF",
"__typename": "ProjectSetType"
},
"companyStandardSet": false,
"filters": {
"generalFilters": {
"endEquipmentClassification": [
false //==========================> This should be "SNE" as in Network tab.
],
"projectScope": [],
"__typename": "GeneralFilter"
},
"companySpecificFilters": {
"certificationStatus": [],
"projectStatus": [],
"organizationUnits": [],
"__typename": "CompanySpecificFilter"
},
"tagFilters": {
"companyTags": [],
"userTags": [],
"__typename": "TagsFilter"
},
"advancedFilters": [],
"__typename": "ProjectSetFilter"
},
"__typename": "ProjectSetWithProjects"
},
"__typename": "ProjectSetResult"
}
}
The code is:
const [fetch, { data, loading }] = useLazyQuery<
ApolloResponse<QueryResult>
>(query, {
variables: { ...queryVariables },
fetchPolicy: 'no-cache'
})
useEffect(() => {
console.log('response', data)
},[queryData])
The configuration I am using with ApolloProvider is:
const httpLink = createHttpLink({
uri: `${Config.API_SERVER}/graphql`
})
export const client = new ApolloClient({
link: httpLink
cache
})
What might be the reason that I am getting a transformed response? Please note that we have an ample codebase and we don't have such issues in any other query calls.