0

I am trying to make a query to get a list of participants. In GraphiQL, this works. However, on the front end with React-Native/RelayClassic, the query only returns one participants

In GraphiQL:

query getJobInfo ($sessionToken: String!, $jobId: String!) {
  viewer(sessionToken: $sessionToken){
    job(jobId: $jobId){
      jobId
      title
      participants(first: 1000) {
        edges {
          node {
           userId
           firstName
           lastName
           profilePic
          }
        }
      }
    }
  }
}

where edges returns many participants

In RelayClassic:

const RelayCompletionPeople = 
  Relay.createContainer(UnconnectedCompletionPeople, {
    initialVariables: {
      jobId: "abcd123",
    },
    fragments: {
      viewer: () => Relay.QL`
        fragment on Viewer {
          job(jobId: $jobId) {
            jobId
            title
            participants (first: 1000) {
              edges {
                node {
                  userId
                  firstName
                  lastName
                  profilePic
                }
              }
            }
          }
        }
      `
    }
  });

where edges returns only one participant

What it is that is causing this to happen?

Are there other places in my code that I need to look in order to return a list?

Any help would be greatly appreciated! I've been stuck on this for quite awhile.

Update:

I found the issue. There was a parent relay container that conflicted with the number of participants that could reach the completionPeople container.

Jordan Daniels
  • 4,896
  • 1
  • 19
  • 29
  • Your query looks to be correct. Have you updated your schema? Can you provide the result of ```console.log(this.props.viewer)```? – soutot Apr 12 '18 at 22:46
  • this.props.viewer = { job: “abcd123”, { participants: { edges: [ node: { firstName: “some name”, lastName: “some name”, profilePIc: “asdfsadf.jpg”, userID: “asdfasdfaf” } ] } } } I have not updated the schema – Jordan Daniels Apr 13 '18 at 01:45
  • the edges array's length is only one. It should be greater than one. The database also shows that their is more than one participant. – Jordan Daniels Apr 13 '18 at 01:49

0 Answers0