I'm trying to perform a Relay query that that depends on data from another relay query
Assuming this runs under a url like /job/{jobID}
React
render() {
const job = this.props.job
return(
<h1>{job.name}</h1>
<TasksOutstanding
project={job.project}
from={job.startDate}
to={job.finishDate} />
)
}
Relay
fragments: {
job: () => Relay.QL`
fragment on Job {
name
startDate
finishDate
project {
${TasksOutstanding.getFragment('project')}
}
}
`,
So I need to get startDate and finishDate into the fragment, something like ${TasksOutstanding.getFragment('project',{from, to})}
But these values (from to) are unknown on the initial fetch ( all I have then is the jobID)
How are people dealing with this? Should I just execute a second request on component did mount once I have the startDate and finishDate values ?