Relay Connection

Learn how to support a Relay connection in GraphQL.

Supporting Relay connections

To support pagination, Relay has defined a set of conventions that models lists of records and related metadata. As an example, let’s review the :menu_items field in the PlateSlate schema. In its current, simplistic state, it looks something like this:

In short, the RootQueryType has a field, menuItems, that returns a list of MenuItem records. If we model the field as a Relay connection, it will change and look something like this:

This necessitates the addition of two new object types:

  • MenuItemConnection: An object type
...