Hi guys basically i wanna use a graphql query consuming it with apollo client, the thing is that when i print the object to see the data, data is set as “undefined”, and i get the error
data: undefined, error: ApolloError: ‘__typename’
Basically the structure of the query is
import { gql } from "@apollo/client";
const FIELD_PLOT_TAGS_DIMS_QUERY = gql`
query {
query_tags_and_dims {
query_RootType {
aLGasResp {
curve_arr {
lift_gas_input_rate {
dimension {
desc
name
}
tag {
help_text
description
is_string
dim_name
min_val
max_val
step_val
modulus
}
}
}
}
}
}
}
`;
And Im using the query as follows just to show the object and see if it’s working
const tangsAndDimsQuery = useQuery(FIELD_PLOT_TAGS_DIMS_QUERY);
console.log("Tags and dims", tangsAndDimsQuery);
I have a similar query and i dont have any problem with it the only difference with the current one is that the level “query_tags_and_dims” in the query that i mentioned is not beeing used, wheni removed this query_tags_and_dims level it works, burt for this case i need that level in the query in order to get specific data, if someone can help me explaining why this is happening it would be very useful since i’m new with apollo client, if ther’s some info that I need to add to make it more clear please let me know