npm react-relay 13.0.0-rc.0
v13.0.0-rc.0

latest releases: 0.0.0-main-a3109d54, 0.0.0-main-a844636d, 0.0.0-main-bb7c65fa...
2 years ago

The one with compiler implemented in Rust.

For reference, see the issue: #3180

To install this version, run:

npm install react-relay@dev relay-runtime@dev
npm install --save-dev relay-compiler@dev babel-plugin-relay@dev

Or using yarn:

yarn add relay-runtime@dev react-relay@dev
yarn add --dev relay-compiler@dev babel-plugin-relay@dev

Breaking Changes

  • relay-compiler is now implemented in Rust and it replaced the JS version from v12.
    • We'll publish a more detailed blog post with motivation for this migration, technical decisions, and challenges we had with it, and results. TL;DR: The main goal was drastically improve the speed of the build step.
    • A few new features that are supported in the new compiler:
      • TypeScript code generation added to the compiler.
      • New directives:
        • @required directive: Improve the ergonomics of handling null values by declaratively telling Relay to either LOG, THROW, or bubble (NONE) null fields. See more: https://relay.dev/docs/next/guides/required-directive/
        • @no_inline: Disable inlining the fragment when it is used in normalization(query) artifacts. Reduce generated artifacts size if the fragment is used in many places.
      • Support for generic query persisting in the configuration.
    • Breaking changes in the new Relay compiler
      • Strict validation for conflicting fields in selections.
      • No field aliases can start with two underscores; these are reserved for internal Relay use.
      • In the new version, the support for custom JS transforms/JS Plugins are not implemented.
    • The quick instructions on how to use the new compiler are here:
  • Updates in runtime, React APIs, and generated flow types for better integration with Flow: and a first class support for types in flow for graphql tags.
    • It may break some of the components that rely on the structure of the generated Relay flow-types.
      • [0a487b6] update Relay's types to use $fragmentSpreads and $fragmentType
      • [9a79039] add new $fragmentSpreads name to RelayResolverTestUtils
      • [d2c256f] Add ReaderInlineDataFragment to GraphQLTaggedNode
      • [8723bd6] Add new runtime types
      • [4556f53] rename FragmentReference to FragmentType
      • [d5fe5d2] make __fragmentPropName and __module_component not left-hand optional since they are within type conditions
  • Statically flow-type the second parameter passed to updaters, optimistic updaters and commitLocalUpdate; it is now derived from the shape of the mutation and is optional. This type had previously been typed as $FlowFixMe (i.e. any); as a result, adding static types here is a breaking change.
    • [10c2a88] Make second parameter to SelectorStoreUpdater have type TMutationResponse instead of $FlowFixMe
    • [df04f8d] Remove default type parameter (any) from SelectorStoreUpdater
    • [1b8b188] Add type param to SelectorStoreUpdater, with a default type of any
    • [2f04533] Add MutationParams type param to various structs and methods
    • [9c7301d] Inform useMutation callers of payloads
    • [e11a334] Modify the public API of Relay.environment to add executeSubscription method
    • [2f4648e] Move MutationParameters to RelayStoreTypes
    • [a8b1e6f] remove $fragmentRefs from updatable fragment flow types

Improvements

  • [096d1b4] Friendly error message if user gets singular/plural wrong in updaters
  • Docs: Fix typo in queries.md (#3602)
  • Cache dependencies in GitHub Actions CI workflow (#3604)
  • website: Fix broken links in the top page (#3613)
  • [c3ad902] Make @required docs public
  • Fix broken links for older website versions (#3655)

Fixed

  • Fix conflicting field warning when using treatMissingFieldsAsNull (#3615)
  • [fe479fb] Fix useRefetchableFragmentNode fetching with initial environment after actor switch
  • [551dd2d] Don't cleanup pending preload queries when you're server rendering

Experimental

  • TypeSafe Updaters: Initial experimental support for updatable queries and assignable fragments. Add a readUpdatableQuery_EXPERIMENTAL method which allows developers to update data in the store using regular assignment, instead of the existing store mutation APIs.
  • Relay Compiler Explorer
    • [29db2bb] New docs page that lets you quickly see the Relay compiler’s output for snippets of GraphQL. It performs the compilation in the browser using a Wasm version of the new Rust compiler.

Misc

  • [38f1c96] Codemod $ElementType/$PropertyType to Indexed Access Types
  • Fix version of the GraphQL.js version to 15.3.0 in babel-plugin-relay (#3628).
  • Bump tmpl from 1.0.4 to 1.0.5 (#3600)
  • Bump axios from 0.21.1 to 0.21.4 in /website (#3595)
  • Fix unit-tests in node v16 (#3608)
  • Adds a README to relay-config (#3656)

Thank you to all contributors who made this release possible!

Full Changelog: v12.0.0...v13.0.0-rc.0

Don't miss a new react-relay release

NewReleases is sending notifications on new releases.