How does one use the apollo graphql HOC's options to provide variables to nested entities?
I'm not seeing this anywhere prominent in the apollo documentation. I'm not even sure what it's called. Is "filtering on nested entities" the correct terminology?
query getPerson($id: ID!) {
getPerson(id: $id) {
id
name
utlizationData(filters: $DataFilters) {
id
data
}
productionData(filters: $DataFilters) {
id
data
}
}
}
Usually I can just pass in an object like
let options = (props) => {
return {
variables: { id: props.id }
}
};
export graphql(MY_QUERY, { options })(MyComponent);
woudl this work?
query getPerson($id: ID!, $utilizationFilter: DataFilters, $productionFilter: DataFilters) {
getPerson(id: $id) {
id
name
utilizationData(filters: $utilizationFilter) {
id
data
}
productionData(filters: $productionFilter) {
id
data
}
}
}
let options = (props) => {
return {
variables: {
id: props.id,
utilizationFilter: { ...props.utilizationFilter } },
productionFilter: { ...props.productionFilter } },
}
};
export graphql(MY_QUERY, { options })(MyComponent);