Using query variable as a parameter in a nested field
I'm trying to use a variable passed as a parameter for a nested field. I can't figure out if its lighthouse not properly parsing this or if I'm using the wrong format. Is this supposed to work? I inspected the parsed query from the server and it seems I'm getting no value for my varaible $page
import { gql } from "@apollo/client";
export const MY_QUERY = gql`
query MY_QUERY($group: String!, $page: Int!) {
myGroups(input: {group: $group, page: $page}) {
groups {
styleA(page: $page) {
name
}
}
}
}
`;
const {loading: Loading, data : Data, error: Error } = useQuery(MY_QUERY, {
variables: {
group: group,
page: page
}
});
You can use the following channels to ask support questions:
This repository and the issue tracker are used to advance the development of Lighthouse. Issues that are neither detailed bug reports nor well thought-out feature proposals will be closed.
I feel this could be a bug? I inspected the parsed graphql selectionSet from the incoming request and that value for $page is not set on the styleA field
However if I hardcode a value, I do see it. At the same time I can access the $page variable at the root level so I confirmed that variable is definitely set when the request is sent. I'm not sure if this is a problem in the graphql library on the client or a problem on the server side parsing the request.
Alright, please provide a pull request with a failing test case then.