I am using Apollo client with my react native app. I also using codegen to generate typed query for me. However, I am keep getting some errors and hope the community can help me. I am not sure if this is codegen problem or apollo problem. Any help will be appreciated.
Everything works perfect when I am not inserting any Fragment into my quest with the placeholder. However, once I add the fragment placeholder into the query, I then get error.
Argument of {} passed to parser was not a valid GraphQL DocumentNode. You may need to use 'graphql-tag' or another method to convert your operation into a document
Here is my file setup.
// graphql.ts
import {gql} from '../../../gql';
import {USER_BASIC_INFO_FIELD} from './fragments';
export const GET_TRIP = gql`
${USER_BASIC_INFO_FIELD}
query getTrip{
trip {
_id
createDate
dateFlexible
departureDate
note
owner {
...UserBasicInfoField
}
}
}`;
import {gql} from '../../../gql';
export const USER_BASIC_INFO_FIELD = gql`
fragment UserBasicInfoField on UserDatum {
_id
firstName
lastName
avatar {
url
fileName
}
school
}
`;