Releases: facebook/relay
v13.1.1
v13.1.0
Misc
- [0ad48b3] removes old aliases in generated files by default. This can be restored temporarily with the compiler config
"flowTypegen": "Compat"
but projects should migrate to using the updated names (e.g.MyFragment$fragmentType
instead ofMyFragment$ref
.
Full Changelog
v13.0.3
Fixes
- [052cf72] [e2888b9] Documentation Improvements
- [c12b08c] Try to fix validateMutation for
__isX
fields - [2ec85b8] Fix null comparison for skip_printing_nulls (#3784)
- [5a16a25] Fix import fragment spread in @raw_response_type
- [3e499ed] Add test to repro weird @raw_response_type behavior
Improvements
- [6be20cb] Add a JSON file query persister strategy to relay-compiler (#3666)
- [f30289f] Print directives on query variable definitions
- [3c70123] Remove unnecessary null values from metadata (#3626)
- [f8123fd] Update non-mutation documentation
- [0b5a8b9] New file category:
Ignore
. To keep some files in__generated__
(or in artifactDirectory) directories - [e5acd86] Easy content changes to relay mutation docs
Misc
- [d7f3efc] Bump parking-lot to version 0.12.0
- [7a3861f] add prctl 1.0.0
- [45126df] Remove
worker_count
from the OperationPersister interface - [da917c9] Deploy 0.171.0 to xplat
- [6649f5f] Daily
common/rust/cargo_from_buck/bin/autocargo
- [becedd9] Intern RelativePath using intern::PathId
- [2a06405] Fixed Repository Reference in monorepo package.json files (#3467)
- [0007a66] Update indexmap to 1.8.0
- [1e51356] Change ImportStatements → TopLevelStatements
Experimental
- [a2fdae5] Stub out Docblock Parser
- [8ece9fc] LSP: Change default response error code to avoid blocking codeactions
- [5fd5059] LSP: Fix a on-hover message
- [c29ee16] LSP: Reuse complete func in relay-lsp
- [ef3efc6] LSP: Attach field type in
detail
field - [690d511] Provided Variables: Add to docusaurus
- [9e60e09] Provided Variables: Remove duplicate definition in generated artifacts
Full Changelog: v13.0.2...v13.0.3
v13.0.2
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 ofrequire
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 [email protected]
- [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
@required
within 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
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
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.
- @required: Improve the ergonomics of handling null values by declaratively telling Relay to either
- 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
forgraphql
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:
- https://github.com/facebook/relay/releases/tag/v13.0.0-rc.0
- https://github.com/facebook/relay/releases/tag/v13.0.0-rc.1
- https://github.com/facebook/relay/releases/tag/v13.0.0-rc.2
Changes since RC.2
Added
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
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 theproject_config
- [e8dfee9] Update type emission docs
- [8e041d3] Update dependency of [email protected]
- [b9adc81] Run build for the test project in github actions (#3696)
- [5baad8c] Move
ProjectConfig
and some other things torelay-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
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
- GraphMode
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]
- Previous Release Notes:: https://github.com/facebook/relay/releases/tag/v13.0.0-rc.0
- Full Changelog: v12.0.0...v13.0.0-rc.1
v13.0.0-rc.0
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.
- #3182 - Thanks @MaartenStaa for the initial implementation!
- New directives:
@required
directive: Improve the ergonomics of handling null values by declaratively telling Relay to eitherLOG
,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.
- TypeScript code generation added to the compiler.
- 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
forgraphql
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
toGraphQLTaggedNode
- [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
- 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.- [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
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, buttrue
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.