I simply want to use an @client (local cache) variable as a query parameter to my apollo server. The docs reference the @export directive (https://www.apollographql.com/docs/react/data/local-state/#querying-local-state)
For some reason, I am unable to do something like
export const GET_COMPANY_DATA = gql`
query GetCompanyData($id: ID!, $name: STRING!) {
group @client @export(as: "name")
getCompanyData(id: $id) {
company {
groups(name: $name) {
data
}
}
}
}
;
Both queries work individually, for example:
{
group @client
}
returns a string as it should from the local cache
export const GET_COMPANY_DATA = gql`
query GetCompanyData($id: ID!, $name: STRING!) {
getCompanyData(id: $id) {
company {
groups(name: $name) {
data
}
}
}
}
;
returns the proper object type
In the docs, they show this example with no reference to the schema:
const query = gql`
query currentAuthorPostCount($authorId: Int!) {
currentAuthorId @client @export(as: "authorId")
postCount(authorId: $authorId) @client
}
`;
What am I doing wrong? I feel like I am missing some fundamental concept...