5 ms·
You can do something like this. This query can be created and run on the client: ``` const SAMPLE_JOIN_QUERY = gql` query ($main_data_id: String!) {
by vikR0001 4y ago
You can do something like this. This query can be created and run on the client:
```
const SAMPLE_JOIN_QUERY = gql`
query ($main_data_id: String!) {
mainData(
main_data_id: $main_data_id)
{
id
main_data_field_1
main_data_field_2
main_data_field_3
related_data{
related_data_field_1
related_data_field_2
related_data_field_3
}
}
} `;
```
- platz 4y agoin other words, it's up to the folks writing the resolvers to manifest and implement that join as a nested field.
- zoover2020 4y agoDataloader does this IIRC
- mst 4y agoWhich means a lot of the time they end up just caching as hard as they can and hoping that's good enough. (which is often, honestly, an entirely rational decision in terms of prioritising limited resources, but still makes me sad)
- mdaniel 4y agohttps://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc may interest you const SAMPLE_JOIN_QUERY = gql` query ($main_data_id: String!) { mainData( main_data_id: $main_data_id) { id main_data_field_1 main_data_field_2 main_data_field_3 related_data { related_data_field_1 related_data_field_2 related_data_field_3 } } }`;
- NonNefarious 4y agoThanks!
- initplus 4y agoRight, but on the backend someone had to think ahead of time that somebody would want to JOIN between those two types, and remember to put the field in place, and implement the JOIN.