useQuery returning undefined
July 13, 2020 at 1:16pmuseQuery returning undefined
July 13, 2020 at 1:16pmHey people, whenever I'm using
useQuery
on my application, the first query that I left below results on data as undefined
(and no error either on Network level, nor on the useQuery return). The second query works perfectly, the only difference is the hardcoded data from the exports, which is working fine from what I saw on the network tab.
Only difference in the HTTP requests that I saw was that the first query sends firstArray and secondArray as variables on the query, but the result is still right. What am I missing?Doesn't work:
export const MY_QUERY: DocumentNode = gql`query someQuery($id: ID!$firstArray: [FirstArrayType]$secondArray: [SecondArrayType]) {firstArray @client @export(as: "firstArray") {field}secondArray @client @export(as: "secondArray") {field}someId @client @export(as: "id")myData(id: $id) {idotherData(first: $firstArray, second: $secondArray) {...}}}`;
Works:
export const MY_QUERY: DocumentNode = gql`query someQuery($id: ID!) {someId @client @export(as: "id")myData(id: $id) {idotherData(first: [], second: []) {...}}}`;