Skip to content

Migrating React Relay from v16 to v17

Relay 17 adds schema validation and editor enhancements.

Key changes

  • The compiler now validates your schema and client extensions. This can be disabled via disable_schema_validation.
  • Edge type names in directives like @appendNode and @prependNode are validated.
  • A new efficient hooks implementation reduces memory usage.
  • Significant improvements to the VSCode extension, including rename refactoring and inlay hints.

Enabling schema validation

By default the compiler validates server schema and client extensions. Example relay.config.json feature flag:

{
"featureFlags": { "disable_schema_validation": false }
}

Disable validation if necessary:

{
"featureFlags": { "disable_schema_validation": true }
}

Migration steps

  1. Upgrade react-relay and relay-compiler to ^17.0.0.
  2. Run the compiler and fix any schema validation errors or opt out with:
    {
    "featureFlags": { "disable_schema_validation": true }
    }
  3. Ensure edge type names in connection directives are correct or disable with disable_edge_type_name_validation_on_declerative_connection_directives.
  4. Verify the new hooks work with your project and update tests as needed.