Skip to content

Releases: facebook/relay

v13.0.2

28 Jan 14:26
Compare
Choose a tag to compare

Fixed

  • [0f84278] Update v13 docs with recent fixes
  • [d745bdf] Check for existence of global before usage (#3646)
  • [03ed79c] Add support for .gql file extensions for schema files
  • [c594f26] LSP: Fix sending code actions for incorrect code location
  • [96f8d0d] fix error message source location (#3745)
  • [8ab1167] remove pattern filtering in glob_file_source, change it to walk_dir_file_source
  • [a7f125b] Update startCursor and endCursor in Connections.md spec (#2655)
  • [8ac91d7] use import instead of require if eager_es_modules = true
  • [f1435c3] Add build for linux-musl target (#3754)
  • [f82885c] Fix grammar error (component access => component accesses) and change fancy ' to simple '
  • [e2eb89e] Remove unused import from example (#3747)
  • [1a81c5e] Fix small warning in an example from the step by step guide (#3746)
  • [74c7ca6] Make clientid field readonly

Improvements

  • [6f9bb96] Added ---validate CLI option (#3771)
  • [cce915c] support providing schemaConfig in single project config files (#3777)
  • [d4d98e4] Make compiler transforms customizable and applied as a Vec of Transforms (#3701)
  • [449bb89] Replace env_logger by simplelog (#3763)
  • [c88609f] add support for multiple warnings in relay-test-utils
  • [34380d1] Add defaults to persistConfig.params
  • [4013eff] Use Semaphore to limit number of concurrent requests when persisting (#3736)
  • [31c156a] remove duplication in deprecated mutation/subscription types
  • [490a77f] Use id field name from schema_config in relay-typegen
  • [c564ce3] Improve Persisted Queries documentation (#3512)

Misc

  • [dbe0cbb] update relay to clap3
  • [c2588c7] automatic update for shelljs@^0.8.5
  • [3328e8d] automatic update for docusaurus-plugin-internaldocs-fb@0.10.4
  • [edd3214] Run npx prettier on README files
  • [436a084] Deploy v0.170.0 to xplat
  • [aa73c44] Start separating out code which determines where files live
  • [11c20f5] Moved fb-only unit tests out of oss
  • [5325cda] Update tokio to 1.15
  • [e4919b1] Upgrade console to 0.15.0
  • [84868c1] move more Relay error messages out of graphql-ir
  • [ed3e82d] Bump nanoid from 3.1.23 to 3.2.0 in /website (#3769)
  • [4699f67] added validation for operation variable names
  • [699d33c] move Relay error messages out of graphql-ir
  • [0c4108d] Make loadEntryPoint from Relay unwrap es6 modules with a default export from a JSResource
  • [010b781] write operation aggregate type in final phase
  • [1fc8122] small refactor in codegen
  • [05ce2e0] Update Cargo.lock (#3767)
  • [d9d8783] update fixture-tests to clap3
  • [2cdc424] Enum changes are breaking changes
  • [e01b840] export path_for_artifact from relay-compiler
  • [2e3089c] unit test for warnings testing util
  • [128d00b] Bump shelljs from 0.8.4 to 0.8.5 in /website (#3751)
  • [857a579] Bump follow-redirects from 1.14.4 to 1.14.7 in /website (#3752)
  • [9ebec17] Custom project config from fixtures
  • [df9621a] Daily common/rust/cargo_from_buck/bin/autocargo
  • [97a0e95] Add fb_only features flag to unit-tests in CI (#3741)
  • [9dab3ff] Remove default fb_only flag on Relay transforms
  • [720f652] impl std::fmt::Write for FlowWriter and TypescriptWriter

Experimental

  • [a70cd06] Add quickfix for @waterfall directive
  • [9ac65f9] Require adding @waterfall to Client Edge fields
  • [5125834] Fix issues with @requiredwithin Resolvers
  • [454de5b] Provided Variables: Changed function signature
  • [c844a5b] Allow runtime to check @required resolver values
  • [88093de] Warn when a provider function returns different values across calls
  • [d543a7a] Provided Variables: Errors for provided variables with conflicting types or modules
  • [309c17c] Provided Variables: Add DiagnosticsResult to transform
  • [[ebc6c95] Rename provided variables using module name
  • [ccde4f7] renamed variables in test fixtures
  • [ee374c8] Ignore field handles for now
  • [f699664] Expose metadata about the transformation
  • [3a83ed4] Assigning undefined to a singular linked field should not assign null
  • [89d38a0] Also explicitly make js a non-updatable field
  • [8da45b0] For concrete assignable fragment spreads, always select __typename
  • [d17c0e5] Add unit tests for fragment spreads with abstract type conditions
  • [64fb548] Generate correct flowtypes for linked field setters
  • [a1221c1] Enable @required for Relay Resolvers
  • [d4ab8a1] Fix binary search in flatbuffer schema
  • [a2b12fd] Introduce assignable fragment validators

Thank you to all contributors who helped with this release!
Special thanks to @ch1ffa for adding many valuable fixes and improvements!

Full Changelog: v13.0.1...v13.0.2

v13.0.1

10 Jan 16:19
Compare
Choose a tag to compare

Added

Fixed

  • [dcf2098] Typing of fetchQuery to use Query type.
  • [1357c25] Ignore target in crates folder (#3723).
  • [b5add1e] Fix eagerEsModules flag in babel-plugin-relay (#3724).
  • [c7ca8f5] Warn for field extensions in config.

Experimental

  • [378104f] Test in RelayResponseNormalizer.
  • [77073a2] Runtime: add provided variables into network layer.
  • [f327738] Runtime: inject provided variables into OperationDescriptor.
  • [e8bf0b6] Always allowing setting data.linked_field = null, even if the linked_field contains no fragment spreads.
  • [4176c0e] Renamed function allRootVariables -> withProvidedVariables.

Misc

  • [ea06433] Using new object! macro where appropriate.
  • [e10dba5] Bump copy-props from 2.0.4 to 2.0.5 (#3731).

Full Changelog: v13.0.0...v13.0.1

v13.0.0

06 Jan 19:43
Compare
Choose a tag to compare

Breaking Changes

  • relay-compiler is now implemented in Rust and it replaced the JS version from v12.
    • The motivation and details for this change are captured here: https://relay.dev/blog/2021/12/08/introducing-the-new-relay-compiler/
    • A few new features that are supported in the new compiler:
      • TypeScript code generation added to the compiler.
      • New directives:
        • @required: Improve the ergonomics of handling null values by declaratively telling Relay to either LOG, THROW, or bubble (NONE) null fields.
        • @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
      • No field aliases can start with two underscores; these are reserved for internal Relay use.
      • Export query hashes to JSON is removed.
    • 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.
  • 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.
  • Removed relay-config.

For more details see:


Changes since RC.2

Added

  • Allow Node interface id field to be configurable. (#3638)
  • [2ea681c] Add FlatbufferSchema.has_type()

Fixed

  • [995bb87] Add include option to single project config file, and warn if it is used.
  • [504b5a8] add serde(alias = "exclude") to SingleProjectConfigFile
  • [f0d7395] do not panic if query_type is not defined
  • Update refetching-queries-with-different-data.md (#3714)
  • [e0911d6] update doc references to renamed props
  • [e959f5c] fix typo in fetch policies
  • [ed24f9d] fix unused variables lints in relay-runtime
  • [a93d922] fix test utils for ResolverFragments

Misc

  • [e075107] Update copyright headers from Facebook to Meta
  • [f16b8da] workaround rust-analyzer bug
  • Remove outdated dependecies from package.json (#3712)
  • [1f01910] Update generate_fixture_tests component on FBS:master
  • [e31cac7] auto lint fixes
  • [ebfa5b1] autocargo: ctp: depend on pxl instead of re-declaring its crates

v13.0.0-rc.2

29 Dec 20:24
Compare
Choose a tag to compare
v13.0.0-rc.2 Pre-release
Pre-release

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

Fixed

  • [b0c5a84] Remove runtime feature flag for @required
  • Correctly extract module names on windows (#3694)
  • [1b30d82] Use WalkDir to find files if watchman is not available
  • Allow default args on required fields (#3612)
  • Stop @preloadable Typescript code generation from emitting an inline require (#3685)
  • Clean the recordsource in mockClear (#3687)
  • Respect excludes when using glob (#3688)
  • Watch js,jsx files with watchman with typescript (#3684)
  • [863c230] Fix incremental mode bug about undefined operation variable
  • [a1f7aba] Matching compiler config and babel plugin options
  • Fix the links of the GraphQL Cursor Connections spec (#3704)
  • Fix markdown in graphql-subscriptions.md (#3702)
  • [18305a1] Add fb_only feature for subscription/live query transforms
  • [95f1ed8] Update error message for invalid paths in config
  • [b18251f] Update Cargo.toml version when publishing main to NPM (#3709)

Improvements

  • Add default exclude paths for multi-project config (#3693)
  • Add readme files to packages (#3689)
  • [a8b9c2c] add overloads for Flow integration to useFragment
  • [73d39b0] Switch to faster hasher for maps/sets
  • Change 'three' assumptions to 'two' (#3654)

Misc

  • [e72ea12] Store connection_interface on the project_config
  • [e8dfee9] Update type emission docs
  • [8e041d3] Update dependency of fbjs@3.0.2
  • [b9adc81] Run build for the test project in github actions (#3696)
  • [5baad8c] Move ProjectConfig and some other things to relay-config
  • [c49cb86] Upgrade to parking_log 0.11.2 and add feature send_guard
  • [3c45f95] typing for useLazyLoadQuery
  • Rebuild OSS test project to use the new flow-typing (#3691)
  • [d4d5f67] simple cleanup to bubble errors up
  • [3f8e1c6] Fix typo (nullalbe->nullable) and failed markup section formatting
  • [c4321e3] extract generated type code to module
  • Bump algoliasearch-helper from 3.4.4 to 3.6.2 in /website (#3652)
  • [14550c8] update license headers
  • [6de307c] use relative imports inside of relay-runtime
  • [4109d4a] Typegen Config: Rename Phase4 -> Compat, make it default

Experimental

  • Typesafe Updaters: Add support for client schema extension fields. Typesafe updaters is an unreleased, experimental project to provide a more ergonomic, typesafe interface for writing updaters.

    • [3099539] Rename fragments from Updatable_x to Assignable_x
    • [09fd085] Add assignable fragment with abstract type to unit test
    • [59c9bc0] Move transform_assignable_fragment_spreads to its own module
    • [45913fc] Add support for client schema extensions in readUpdatableQuery
    • [9a9dc85] Assert that readUpdatableQuery throws when encountering client schema extensions
    • [24bab36] Rename methods, etc. related to typegen for clarity

v13.0.0-rc.1

08 Dec 20:22
Compare
Choose a tag to compare
v13.0.0-rc.1 Pre-release
Pre-release

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

Fixes

  • Evaluate custom scalars first (#3671) [a0160e8]
  • Generate exact imports when using CommonJS and artifactsDirectory (#3675) [bc03126]
  • Update the way we handle different paths in single project config file. [6eea5a8]

Improvements

  • Do not gate required directive behind feature flag [964b2e4]
  • Update compiler installation instructions [b67bb55]
  • Update persisting docs [15aacb0]
  • Add MacOS ARM64 build target to relay-compiler for better M1 Mac support (#3667) [dea3f32]
  • Fixed example of 'Refreshing Fragments' (#3664) [f906565]
  • Move updatable fragment errors into own module [a961cf4]

Experimental

  • Provided Variables
    • Add JS module 'require's into generated artifacts [df7335a]
    • Fix provided variables bug in transform [390bf1a]
    • Renamed provided variable directive [7930ab7]
  • GraphMode
    • Handle more node types [7730a5b]
    • Add utility to insert GraphMode into a MutableRecordSource [03647ab]
    • Support more node types in transform [65bf22f]

Misc

  • Use cosmiconfig instead of relay-config (#3678) [4c5ddec]
  • Remove relay-conifg (#3677) [46a4084]
  • Move validation messages out of graphql-ir [d92b9e5]
  • GitHub Actions: remove redundant tag check [609f32b]
  • Shorten codegen code with object! macro [9157236]
  • Convert more of build_ast.rs to use object! macro [eb45f66]
  • Remove publish_packages, this is moved to GitHub Actions [a4d3c2c]
  • Update itertools to 0.10.3 [f3f3ebb]

v13.0.0-rc.0

03 Dec 20:43
Compare
Choose a tag to compare
v13.0.0-rc.0 Pre-release
Pre-release

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

v12.0.0

01 Sep 16:29
Compare
Choose a tag to compare

Relay Release Notes - 12.0.0

Commits: v11.0.2...main

About the Release

This is release contains a long list of new fixes and additions to Relay that was added in the last few months: runtime optimizations, react integration updates, logger updates, internal type-safety, documentation updates, and more.

It also contains a few small, but possibly, breaking changes. One of which is related to the Abstract Type Refinement, others to the live query behavior.

The Relay team is continuing work on the new rust-version of the compiler, and VS Code extension. As well as experimenting with the new features: multi-environment runtime support, advanced client-state management APIs. We hope to include these in the upcoming releases.

Thanks to all contributors for your work and support!

Breaking

  • Relay Runtime: Promote type refinement to default feature (no flag). In OSS this flag was false by default, but true in internal configuration [2732db5].
  • useQueryLoader will not cancel network requests, except for live queries [211d6fe].
  • useLazyLoadQuery will not cancel network requests, except for live queries [a75da57].

Added

  • Add Suspense logging to Relay Network Logger.
  • Add log event for when QueryResource suspends.
  • Add suspense logging when suspending from containers.
  • Add log event for when FragmentResource suspends.
  • Website: First draft of Relay Compiler Playground.
  • React: Support double invoking effects in QueryRenderer.
  • Runtime: Enabled unique subscription root: every response received is now processed in a unique Relay store root.
  • Runtime: Enable batched store updates by default.
  • Runtime: FragmentResource store revision optimization.
  • Add Suspense logging to Relay Network Logger.
  • Add execute.* events to the Relay Logger.
  • Expose various hooks utils from relay-runtime: getPaginationMetadata, getPaginationVariables, getRefetchMetadata, getValueAtPath, type Direction [3b6f70d].

Fixed

  • React: Subscribe on commit in pagination container.
  • React: Actually subscribe on commit in fragment and refetch containers.
  • React: Prevent tearing in refetch container between render and commit.
  • React: Flip useTransition tuple.
  • React: Update relay useTransition tests.
  • Don’t keep unnecessary ref to props in FragmentSpecResolver.
  • Fix memory leak in containers [5a0c4c6].
  • Fix Relay Dev Tools network events.
  • Fix throwing promise from RelayModernFragmentSpecResolver.
  • Add improved type safety to useSubscription API.
  • OperationTracker now exposes pending operations affecting owner; display name for suspense promises are more accurate.
  • Do not re-throw errors for incremental payloads that may invalidate the whole query.
  • Runtime: Make RelayPublishQueue.run a no-op if no pending updates.
  • Runtime: Ship FragmentResource store revision optimization.
  • Check if global exists before calling ErrorUtils (#3465).
  • Fix double _publishQueue.run() in OperationExecutor.
  • Use the provided requestSubscription fn in useSubscription.
  • Code Cleanup: Remove RecordSource/RecordSourceMapImpl indirection.
  • Remove duplicated active observable tracking in _processModuleImportPayload.
  • Do not emit extension in compiler includes (#3518).
  • Check if global exists before using it (#3525).
  • Improve handling of falsy conditions and @Skip.
  • Fix a bug in RelayReplaySubject that caused indefinite suspense in React double invoke.
  • Do not read from the store if no onNext callback is provided.
  • Make createOperationDescriptor type safe.
  • Set unique root ID before processing a non-incremental payload.
  • Track store writeEpoch in FragmentResource.
  • Update updater docs to include payload.
  • Small optimization in RelayPublishQueue [6b95ff8].
  • Reduce FragmentResource memory usage [bd35151].
  • Avoid calling environment.lookup when not needed in QueryResource.
  • Release redundant temporary retains when the component commits.
  • Support batched responses in RelayResponseCache.
  • OperationTracker now exposes pending operations affecting owner; display name for suspense promises are more accurate.
  • Rename QueryExecutor to OperationExecutor.
  • Rename transactionID to networkRequestId in log events.
  • Documentation/Website/Typo Fixes: #3439, #3456, #3479, #3492, #3493, 3495 #3517, #3530, #3532, #3535, #3545, #3564, #3566, #3569, #3570, #3576, #3552, #3546, #3550, #3577.

Misc

  • Update batching async module scheduling [8e3e210].
  • Only batch async module payload if there is more than one pending module payload.
  • Add ApplyMutation test for RelayEnvironment.
  • Additional testing for applyMutation.
  • CI: remove node 10 and 15, add node 16 (#3466).
  • Bump lodash from 4.17.20 to 4.17.21 in /packages/babel-plugin-relay (#3482).
  • Bump path-parse from 1.0.6 to 1.0.7 in /packages/babel-plugin-relay (#3559).
  • Update React flow types.
  • Add disallowWarnings(...) to some Relay unit-tests.
  • Remove useCustomizedBatch from runtime.

v11.0.2

15 Apr 17:38
Compare
Choose a tag to compare

Added

  • Add Relay CodeSandbox to website [f71d1e2]
  • Add onSubscribe to CacheConfig [0451857]
  • Create operation description with correct cache config in usePreloadedQuery [e0713aa]

Improvements

Fixed

  • Fix onNext callback in requestSubscription [579b8f2]

Misc

  • Rename QueryExecutor to OperationExecutor
  • Remove RelayProfiler from RelayResponseNormalizer.normalize [6294195]
  • Drop RelayModern prefix from QueryExecutor [edef218]
  • Remove RelayProfiler from RelayModernStore.prototype.lookup and RelayProfiler.instrumentMethods [f486653]
  • RelayProfiler no longer skips methods starting with @ [1bfa996]
  • Remove RelayProfiler.instrument [cc2758b]
  • Remove support for "*" profile event [6e18b96]
  • Rename areEqual{OSS => ArgValues} [b8d2694]
  • Remove fbjs/lib/ErrorUtils Dependency [5ed076e]
  • Remove mapObject [4645888]
  • Export type for RequiredFieldLogger [5a5f5c7]
  • Replace fbjs/lib/invariant with invariant (#3448) [3982f9d]

v11.0.1

24 Mar 14:00
Compare
Choose a tag to compare

Fixed

  • Fixed several broken website redirects
  • Store updater directives: do not insert existing node again in connection (#3373)

Documentation Improvements:

This release contains a set of updates to the new Relay website. Some of the PRs are listed here explicitly.
Thank you for your contributions.

  • Replace preloadQuery with loadQuery (#3412)
  • Remove mutation from the server specification (#3381)
  • Fix markdown issue in fragments.md (#3408)
  • Fix typos in loading-states.md (#3411)
  • Fix typos in docs (#3400)
  • Fix typo in the code example in "Introducing Relay Hooks" (#3399)
  • Update use-mutation.md (#3393)
  • Updated load-query.md (#3391)
  • Update use-pagination-fragment.md (#3392)
  • Fix typos in the "Introducing Relay Hooks" blog post (#3394)
  • Thinking-in-graphql.md small typo (#3386)
  • Fixes typo in docs (#3389)
  • Switch text under headings to be <p> (#3385)
  • Fix markdown issue in use-preloaded-query.md (#3384)
  • Use updated Flow object syntax (#3387)

v11.0.0

09 Mar 14:56
Compare
Choose a tag to compare

For our announcement on Relay Hooks, check out our blog posts on relay.dev and Facebook Open Source. For docs, see our updated docs website at relay.dev/docs, and for an update on our upcoming releases, see this issue.

Breaking

  • New version of fetchQuery:
    • New: New version of fetchQuery now returns a lazy Observable which you can subscribe to. It will perform in-flight request de-duping of identical requests. Ignores any Network Layercaching by default, but supports a [fetchPolicy](https://relay.dev/docs/en/experimental/a-guided-tour-of-relay#fetch-policies) to check data cached in the Relay Store.
    • Deprecated: Previous version of fetchQuery renamed to **** fetchQuery_DEPRECATED. Previous behavior returns a Promise (can’t be observed). No request de-duping.
    • Changes in Exports:
      • react-relay: fetchQuery exported from react-relay now has updated behavior and function signature. To access previous version of fetchQuery, import fetchQuery_DEPRECATED from react-relay or react-relay/legacy.
      • relay-runtime: fetchQuery exported from relay-runtime now has updated behavior and function signature. To access previous version of fetchQuery, import fetchQuery_DEPRECATED from relay-runtime.
  • getDataID was renamed from UNSTABLE_DO_NOT_USE_getDataID. This config option is now stable. It can be passed to the Relay Environment and Relay Store as an option that will be used to compute the Data ID for the given record.
  • Default value for gcReleaseBufferSize is now 10 (previously 0).
    • When a query is manually released, for example when a query component unmounts (QueryRenderer or useLazyLoadQuery), Relay will temporarily retain the query in the “release buffer” until the buffer is full. With a buffer size of 0, released queries would not go into the buffer and would be immediately removed from the store cache.
    • With a default buffer size of 10, this means that queries will remained cached in the store for a longer period of time after they unmount, which allows fetch policies like store-or-network. to actually reuse cached data when navigating back to previously visited views.

If upgrading from experimental release

  • The default UNSTABLE_renderPolicy is now always “partial”. We don’t expect this to produce any issues, and will only affect you if you are upgrading from an experimental release. This option can still be configured, but we will completely remove it in the upcoming releases.

Added

Relay Hooks

  • New Relay Hooks APIs added to react-relay and react-relay/hooks. See this issue for more details.
    • relay-experimental has been removed from the source code, and no new experimental builds will be published to npm.
    • We will share more external communications with the community as well as publish our updated docs once a stable release is published.
  • New version of fetchQuery added. See description in Breaking Changes.

General

  • Added ConnectionHandler.getConnectionID to make it easier to get a connection ID for usage in updaters or declarative connection mutations (@kyarik: #3332)

Improvements

If upgrading from experimental release

  • Hooks are now resilient to React effects being re-invoked (e.g. during Fast Refresh).
  • Un-actionable warning that fired when fragment data was missing without being fetched has been removed.
  • loadQuery accepts a fetchPolicy of 'store-only'
  • loadQuery now warns, instead of throwing, if called during the render phase.

General

  • getDataID is now a stable config option. See description in Breaking Changes.
  • Default value for gcReleaseBufferSize is now 10. See description in Breaking Changes.
  • ConnectionHandler will no longer create edges with an undefined cursor field. This also applies to edges created via @appendNode or @prependNode. (#3278)
  • Several tests migrated to be compile their graphql with Rust Compiler.

Fixed

If upgrading from experimental release

  • If loadQuery is called and no network request is made (i.e. if the data is available in the store and the fetch policy allows it), the query is retained in the environment.
  • loadQuery now includes the network cache config in the operation descriptor that is executed against the environment.