react-relay v4.0.0 Release Notes

Release Date: 2019-04-30 // almost 5 years ago
  • Commits: v3.0.0...v4.0.0

    ๐Ÿ’ฅ Breaking

    • Fragment Container, Refetch Container, Pagination Container now always expect an object as the fragment declaration (single graphql tag is no longer valid input), since graphql tags no longer implicitly produce object wrappers during our babel transform: 1f26086.
    • ConnectionTransform will generate additional selections under the existing edges/pageInfo fields. A side-effect of this is that if edges/pageInfo were aliased, the generated fields now show up under the alias rather than as non-aliased sibling selections: 50008ab -
    • Compiler no longer allows directives to be used in locations not defined in the schema. Previously the compiler doesn't check the directives' locations, it causes directives being used on wrong places, e.g. @connection on a fragment definition.
    • Compiler now validates that all @arguments are defined on the callee

    ๐Ÿ‘Œ Improved

    โšก๏ธ Updates in testing tools:

    • There are two main modules that you may use in your tests:
      • createMockEnvironment(options): RelayMockEnvironment
      • MockPayloadGenerator and @relay_test_operation directive
    • With createMockEnvironment, you will be able to create an instance of RelayMockEnvironment, a Relay environment specifically for your tests. The instance created by createMockEnvironment is implementing the Relay Environment Interface and it also has an additional Mock layer, with methods that allow to resolve/reject and control the flow of operations (queries/mutations/subscriptions).

    - The main purpose of MockPayloadGenerator is to improve the process of creating and maintaining the mock data for tested components.

    โž• Added full support for client schema extensions: now full GraphQL types can be defined in the client schema (as opposed to just extending existing server types), and they will be properly retained during garbage collection when rendered.

    Using new fetchQuery implementation inside QueryRenderer which de-dupes identical requests in flight.

    โž• Add config support for babel-plugin-relay/macro (#2646) @sgwilym

    ๐Ÿ›  Fixed

    • ๐Ÿ›  Fixed compiler error when watchman cli was missing: 2958b97

    Misc

    • ๐Ÿ”„ Changed main entry point in package.json for react-relay and relay-test-utils
    • ๐Ÿ“ฆ createRelayContext now in relay-runtime package to prevent multiple instances of packages that have "peerDependencies".
    • ๐Ÿšš RelayCompat is removed.

    Experimental

    • โž• Added experimental support from @stream and @stream_connection
    • ๐Ÿ‘Œ Improved support for @match directive
    • ๐Ÿ›  Fixed passing down and comparing fragment owners in a few places that were missing.
    • โž• Added experimental scheduler to QueryExecutor.