I'm querying for 2 objects which are both needed in the same component. The problem is that one of the queries have to wait on the other and use its id field as an argument for the other. Not sure how to implement this.
const PlayerQuery = gql`query PlayerQuery($trackId: Int!, $duration: Int!, $language: String!) {
subtitle(trackId: $trackId, duration: $duration) {
id,
lines {
text
time
}
}
translation(trackId: $trackId, language: $language, subtitleId: ???) {
lines {
translation
original
}
}
}`;
So in the query above translation needs subtitleId as an argument which is returned by the subtitle query.
I'm using Apollo both on the client and on the server.