BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Facebook Releases Relay 7 for Building Data-Driven React Apps with GraphQL

Facebook Releases Relay 7 for Building Data-Driven React Apps with GraphQL

This item in japanese

Relay, a JavaScript framework for building data-driven React applications with GraphQL, was recently updated with the release of version 7. This release contained improvements to error handling and Relay hooks.

A new directive was added in Relay version 7, @DEPRECATED__relay_ignore_unused_variables_error, in order to suppress errors after migration from the GraphQL NoUnusedVariablesRule to RelayIRTransform validation. This directive temporarily suppresses errors that would not have appeared previously, allowing development teams to fix issues incrementally during a Relay upgrade.

The Relay team improved several other features, including the constraint for a @refetchable directive on a fragment no longer enforcing that the argument for the node field is called id, just that it is an ID type. Developers can also now select the __id field wherever __typename can get selected to fetch the internal cache key for an entity to update records without an id.

Beyond several other bug fixes, many experimental features are available with Relay 7. Improvements to the approach of using Relay Hooks include performance improvements for useFragment, correct disposition of ongoing requests with useQuery, and not suspending indefinitely when the server does not return all requested data with useQuery.

Relay is a JavaScript framework built by Facebook for applications using GraphQL. Relay provides a bridge between React and GraphQL. With Relay, React components can specify what data they need and get it, allowing components to get composed while the data needs of the app get localized per component. Relay provides static queries and ahead-of-time code generation.

Relay is open source software available under the MIT license. Contributions and feedback are encouraged via the Relay GitHub project and should follow the Relay contribution guidelines.

A full list of updates and breaking changes may be found in the Relay 7 release notes.

Rate this Article

Adoption
Style

BT