github graphile/crystal v1.5.0
Relay viewer tag added

latest releases: pgl5b21, v4.14.0, v4.13.0...
7 years ago

The Relay standard viewer field has been added to PostGraphQL. Now Relay users can query root PostGraphQL fields without worrying about the Relay imposed limitations for root fields defined in facebook/relay#112. For an example of how the viewer field works see the following:

{
  thing(id: "dGhpbmc6NQ==") { ...thing }

  viewer {
    id
    thing(id: "dGhpbmc6NQ==") { ...thing }
  }

  node(id: "viewer") {
    id
    ... on Viewer {
      thing(id: "dGhpbmc6NQ==") { ...thing }
    }
  }
}

fragment thing on Thing {
  id
  note
}

The viewer field simply returns all of the fields in the root query just nested one level deeper. This is very helpful for Relay applications and other frameworks that put limitations on what can be included in a root field. The Viewer type (returned by the viewer field) also implements the Node interface with a non-opaque ID of simply “viewer” making it re-fetchable by Relay.

The viewer field is also included in all mutation payloads now which can be helpful for Relay and non-Relay users alike as now you can query your entire data domain from the scope of a mutation payload.

Non-Relay users needn’t worry as this addition does not affect you at all. It provides a great benefit to Relay users which makes it worth including in PostGraphQL.

Finally, if you were using the viewer field name in your application with a procedure to return the authorized user object, you can still use standard field names like me or game.

Bugfixes

This release also contains a few bugfixes. Notably:

  • Falsey values can now be used in the update mutation instead of being discarded with a falsey check—@ferdinandsalis in ac15f8e

Don't miss a new crystal release

NewReleases is sending notifications on new releases.