Relay pagination with GraphQL interfaces

159 Views Asked by At

I am building a GraphQL query that has an interface and multiple types implementing that interface for different data endpoints.

interface baseInterface {
  id: ID
  name: String
}
type type1 implements baseInterface {
  id: ID
  name: String
  location: string
}
type type2 implements baseInterface {
  id: ID
  name: String
  createdBy: string
}

type1 gets the data from service1 and type2 gets data from service2. The data is large from both the services so I can't pull all of the data in memory in one call. How does the Relay pagination work here? The two things I am trying to solve is:

  • how do GraphQL interfaces work with Relay pagination. When the client has this query,
query findTypes(first:10, after: $opaqueCursor ) { 
 id,
 name
}

how does it render paginated data from both the sources? Would it build two paginated sets and use different cursors? And will it return 10 from each?

  • how does Relay pagination work with large data sets?
0

There are 0 best solutions below