Jordan Eldredge

Why use the Relay Connection Spec?

|

Reddit user SherlockCodes recently asked this question:

Why relay spec?
Why do people like to use the relay spec?
Why the extra boilerplate (node, edges, etc)?

I thought it was a good question and one I feel represents the ecosystem’s general under appreciation for the value this specification can provide, so I thought I’d reply:


You might enjoy this GraphQL Conf from last month:

It walks through deriving the Connection spec from scratch motivated by confronting the different challenges of optimal pagination logic. It also demonstrates how it generalizes the many challenges associated with fetching lists, and allows clients (like Relay) to generically implement sophisticated/optimal list fetching logic.

The original goal was to upstream the connection spec as a “best practice” within the larger spec, but the team lost momentum to push that through once we had solved it internally.