v4.0.0
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), sincegraphql
tags no longer implicitly produce object wrappers during our babel transform: 1f26086.- Codemod to update to new signature: https://gist.github.com/kassens/3e2ef9af1e5e1128f8fba3362bb92f98
- 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 ofRelayMockEnvironment
, a Relay environment specifically for your tests. The instance created bycreateMockEnvironment
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.
- There are two main modules that you may use in your tests:
-
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 inpackage.json
forreact-relay
andrelay-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.