github facebook/relay v16.0.0

latest releases: v16.2.0, v16.1.0
6 months ago

Breaking

  • Arguments passed to the filters keyword for the @connection directive will now throw if they are invalid instead of being a no-op. [2dd7954]

Flow-related breaking changes:

  • Explicit type annotations are no longer needed for commitMutation [603ce54] and useMutation [051e469].
  • Records can no longer be modified directly and can only be passed to utility functions such as those in RelayModernRecord.js. [21a896c]
  • Added the babel-plugin-syntax-hermes-parser plugin, which switches Babel to use hermes-parser instead of @babel/parser, and enables full syntax support for Flow. [c320a89]
  • [1d95ce2] - Make React.Element fully opaque

TypeScript-related breaking changes:

  • Empty variables will now be typed as Record<PropertyKey, never> instead of as {} to represent an object without properties. [16910c9] (#4404)
  • Nullable fields will now yield a union of the actual type, null and undefined (T | null | undefined) instead of (T | null). To keep the old type generation behavior for now, you may set the typescriptExcludeUndefinedFromNullableUnion feature flag in the relay-compiler config as follows. Note the feature flag will be removed in a future release. [cc47bc9] (#4380)
{
  "language": "typescript",
  "typescriptExcludeUndefinedFromNullableUnion": true
}

Bug Fixes

  • [313d62d] - Don't assign to frozen objects and arrays
  • [a5e0ba3] - Fix flow errors in the reactive executor and relay runtimes
  • [17f4abf] - Make isWithinUnmatchedTypeRefinement be set on a per-fragment basis
  • [33d5475] - Fix RelayObservable ifEmpty: Cannot access 'current' before initialization
  • [4123383] - Do not freeze array buffer views
  • [a2c2b64] - Get compiler playground working again (#4336)
  • [04005db] - Replace invalid variable characters for import name (#4293)
  • [0fce632] - Fix refetching and pagination when using a custom nodeInterfaceIdField (#4053)
  • [e784ee4] - Fix version number parsing in cannotReadPropertyOfUndefined__DEPRECATED (#4314)
  • [a79038b] - Fix some grammar in validation selection conflict error messages
  • [6f30869] - Updating connection handler to be able to deal with streamed edges that are already in memory
  • [2699206] - Always use / as path separators in generated artifacts (to allow stable compilation between windows and unix-based systems)

Experimental

Relay Resolvers are an experimental feature of Relay which allows you to model derived data, and soon client state, in your Relay graph. Since our last release we’ve put considerable work into stabilizing the feature. This includes bug fixes across our compiler, type generation, runtime and LSP (editor integration). In particular, contributors have fixed a number of bugs which made it impossible to use Relay Resolvers with TypeScript.

Documentation:

  • [bd95f00] - Updates RelayResolvers docs to include terse syntax and updates to the module resolution details

Improvements:

  • [15c2715] - Fix compiler issue with stale artifacts for Resolvers in watch mode (#4415)
  • [0b2791f] - skip_redundant_nodes: do not mess with order of selections within inline fragments with client edge metadata
  • [77304c2] - Add flag and validation for strict resolver flavors
  • [3d66ad8] - Add artifact with schema resolvers
  • [998fd49] - Regression test for not detecting undefined variables on resolver fields
  • [556d696] - Fix Relay Resolver typegen for Typescript-based projects (#4274)
  • [508dca3] - Add handleMissedUpdates to subscription callback
  • [c899a68] - skip generating client edge queries for base project fragments
  • [bb50fdf] - Support Graph Mode GraphQL response data processing
  • [c93322b] - Add directives to the base project resolvers (types/fields)
  • [5d22d1c] - Show a helpful error if a resolver returns an interface with no implementors (#4428)
  • [a8dc8a9] - Retain description for terse resolvers
  • [64b707d] - Set the cache as missing state when missed updates
  • [b09fd94] - Support for suspend after initial mounting for plural fragments
  • [f4bdd5a] - Components can suspend after initial mounting
  • [900f40c] - Update operation tracker for optimistic updates
  • [b2dcbfe] - Allow @required to bubble to client edge resolvers.
  • [b23fe58] - Split out method in RelayReader responsible for propagating resolver metadata
  • [fca7a9c] - Catch errors thrown during .read()
  • [4a1d71d] - Log Required fields even if not missing data
  • [5dfb88b] - Simplify what we keep in the store for resolver errors
  • [feaba45] - Validate that resolver fields are always nullable
  • [147498f] - non-nullable __relay_model_instance
  • [6e4ff95] - Unify handling of plural/nullabile resolver field types
  • [2732238] - Reflect correct resolver type in test fixture
  • [f0e802a] - Ensure incremental builds include all @rootFragment fragments
  • [6a80a0f] - Add runtime test validating plural @live field
  • [6347254] - Fix bug where suspending @weak resolver values were getting normalized
  • [3c44796] - Enable tsx extension on relay resolvers (#4303)
  • [a02b706] - Don't wrap nullish values returned from @weak model resolvers
  • [0fe2553] - Allow legacy resolvers with @rootFragment on model types
  • [fd06faa] - Preserve correct resolver path across client edges
  • [fccb3c8] - Allow resolvers with @rootFragment on model types
  • [b4099fc] - Type bug with resolverDataInjector and resolvers that accept args
  • [5c0a740] - Fix for @required on client edges
  • [ed612b8] - Add feature flag for operation tracking that would work with lazy React notification
  • [cf1650e] - Log on LiveResolver batch start/end
  • [f7d62f4] - When adding a concrete object that implements an interface to a schema, also modify interfaces

Improvements

  • [58da806] - Allow configurable @defer/@stream names (#4467)
  • [c4618c6] - Add support for copying field errors into the store
  • [9a96c6a] - Improve error message clarity
  • [4ffd869] - Add typescriptExcludeUndefinedFromNullableUnion to SingleProjectConfigFile (#4482)
  • [51fca35] - Stabilize printing paths in fixture tests
  • [9c7b92a] - Type-safe updaters for TypeScript (#4370)
  • [0bc4142] - allow using provided variables with refetchable fragments
  • [38a08ed] - Allow printing interfaces implementing interfaces
  • [1328fc1] - Export node from assignable fragment (#4409)
  • [bacd1ae] - Allow extending interface interfaces
  • [7ba6387] - Add getFields() to RelayModernRecord
  • [a062e17] - Extend multiple schemas in parallel
  • [699b0ab] - Improve fragment and fragment spread hover
  • [091a4f0] - Allow ast_diff_in_doc drops machine readable struct
  • [99ce43f] - Inject changed schema files when loading from saved state
  • [bc40b4b] - Fix error message in UpdatableDisallowRelayResolvers error
  • [7a14de0] - Extract type for RequiredFieldLoggerEvent
  • [95c54b4] - Allow persisting to also include the query text for safe migration (#3917)
  • [de6594b] - Using opaque type trick to enforce nested relay entry point safety
  • [ce74006] - Recommend Babel extension to fix VSCode syntax highlighting (#4324)
  • [d04c7be] - MockPayloadGenerator support for @no_inline with args
  • [39ebc1c] - Avoid reusing AST nodes (#4309)
  • [35fea88] - Add parent node information when providing error about printing empty selections
  • [2108aed] - Add support for deferred fragments in MockPayloadGenerator

Documentation

Additions:

  • [356bc78] - Docs v15.0.0
  • [5df8aee] - Add blog post highlighting changes in Relay 15 (#4258)
  • [098a84e] - Add Réa to list of relay users (#4430)
  • [6e9e000] - Build Wasm compiler explorer when deploying docs website (#3928)
  • [1ef73b2] - Update mutations-updates.md (#4424)
  • [563c570] - Update connections-pagination.md (#4423)
  • [8fcf1fc] - update docs for missing field handlers (#4259)
  • [2877676] - Add doc explaining client mutation ID and actor ID

Typo fixes:

  • [610806b] - Fix typo in testing-relay-with-preloaded-queries.md (#4405)
  • [3b9f90a] - Fixed typo in refetchable-fragments.md (#4427)
  • [b998f9b] - fix(docs): remove duplicate text in MutationConfig.md (#4462)
  • [0d63f5a] - Update documentation with corrected usage of useTransistion
  • [10f00e4] - Fix typo in tutorial (#4444)
  • [555ebfd] - Fix link to an explanation of @raw_response_type usage (#4435)
  • [5450fcd] - Fix small typo in tutorial (queries-2.md) (#4398)
  • [6910c55] - Connections Doc Minor Typo Fix (#4369)
  • [34a3581] - Fixed a typo in the website tutorial (#4342)
  • [9942761] - Fix typo in load-query.md documentation (#4106)
  • [7094921] - docs: add missing comma (#4295)
  • [dc659df] - docs: Fix typo in getting-started/installation-and-setup.md (#4306)
  • [442d494] - Fix typo in jest method name (#4271)

Tutorial updates:

Other corrections:

  • [9eb2747] - fix(docs): readInlineData function (#4451)
  • [0ce764a] - Remove flow-type parameters from Relay API references
  • [9a1ea37] - A full example of creating Relay environment in Relay Environment Provider docs
  • [5357c44] - fix(docs): Error boundaries link points to React legacy docs (#4392)
  • [0bf353a] - Update commit-mutation.md (#4346)
  • [7e42ea1] - Fix invalid usage of useMemo() in docs (#4281)
  • [37ad7f2] - Update fetch-query.md (#4296)
  • [d431902] - Update advanced-pagination.md (#4264)
  • [2f38a11] - Fix grammar error in the fragments page of docs (#4267)
  • [6ed8289] - Update record method for filling in missing data docs (#4249)

Tooling

  • [392ea1f] - Build compiler playground as part of GitHub CI (take 2) (#4470)
  • [5cadb43] - Improve inline fragment suggestions for abstract types (#4453)
  • [f67e9c5] - Make the Relay Compiler Terminal Transient (#4455)
  • [1ae14fe] - Add a subcommand to dump definitions to file
  • [3b96b01] - Enable goto def in LSP to goto the actual schema definition (#4434)

Miscellaneous

  • [d4ca7d9] - Add From extension AST to definition AST
  • [beb0e92] - graphql-syntax: add comments explaining FloatNode
  • [a55a3fa] - Add newtype for Union::name
  • [1c8917b] - Make InMemory schema cloneable
  • [4d9f255] - Level-based logging for graphql schema tools
  • [a203dc6] - Remove duplicated flow definitions from arvr/js
  • [48ce83a] - Update strum and enable the derive feature
  • [59912af] - Remove unused method arguments (#4326)
  • [17d9f9f] - Remove Flight support in Relay Compiler
  • [5dd6914] - Create stand-alone PR to fix VSCode extension build (#4275)
  • [cc1daa1] - Create shared mock for scheduler (#4313)
  • [f5c48cd] - Relay: More Resilient cannotReadPropertyOfUndefined
  • [46fa2fa] - Remove experimental.abstract_locations config
  • [3073f1e] - Add feature flag to log missing data using invariant in prod
  • [e2b8516] - Remove inference_mode config now that LTI is the default

Flow Changes

  • [92aaeaf] - Add TRawResponse to useClientQuery generics to support @raw_response_type
  • [9b7e157] - Strictify EntryPoint typing by making TPreloadParams invariant
  • [fe26a5e] - Fix flow suppression in buildReactRelayContainer
  • [79ba933] - Suppress forwardRef flow error on WWW
  • [fdafa27] - Enable mapped type
  • [eb29556] - Replace $Call with ReturnType in flow typegen
  • [037a28f] - Make Props readonly
  • [f0dbef2] - Codemod $Shape to Partial in Relay files, suppressing errors
  • [f9cba52] - Update setLinkedRecords flowtype
  • [e43a369] - Extract events into named types (#4254)

Don't miss a new relay release

NewReleases is sending notifications on new releases.