Releases: facebook/relay
Version 18.2.0 Release Notes
Relay version 18.2.0 comes with several bug fixes and improvements!
New compiler capability: Relay Codemods
Codemods are tools which enable you to programmatically update your code. These are especially helpful if you want to upgrade an API across your whole codebase without needing to manually change each call site. The Relay compiler, with its understanding of your GraphQL snippets, is well positioned to help with these kinds of tasks. In Relay 18.2.0 we are introducing Relay Codemods.
We currently support two different codemods:
mark-dangerous-conditional-fragment-spreads
marks places where@alias
is required to make a fragment spread safe. This can enable you to turn on theenforce_fragment_alias_where_ambiguous
feature flag. Learn more in the@alias
docs.remove-unnecessary-required-directives
identifies places where@required
is unnecessary because it's used on a non-nullable field within a fragment or query that is@throwOnFieldError
, and removes the@required
directive.
We are looking forward to helping Relay users with more codemods in the future!
New experimental hook for pagination with prefetching
It is often possible to speed up list pagination by pre-loading one or more pages of results ahead of what the user is currently viewing. Our previous APIs made this difficult to fetch the next page of data without also rendering it at the same time. We are currently exploring an experimental API to make it easy to manage paginated lists with prefetching.
Read more in the docs: usePrefetchableForwardPaginationFragment
Expand places where @catch can be used
The @catch
directive can now be used on fragments, queries, mutations and aliased inline fragments. This enables more flexibility in controlling how field errors are handled.
Bug fixes
- [682ac5a]: Include Relay resolver import type when field is selected on query as well (#4820) by Ernie Turner
- [d6cb5a2]: Update required-on-non-null validation to also work within @catch by Gordy French
- [356327c]: Fix bug in Connections with errors by Evan Yeung
- [9571d80]: Fix result type generic for Error to not double-nest by Itamar Kestenbaum
- [af35418]: Ignore @dangerously_unaliased_fixme when comparing structs by Jordan Eldredge
- [f166d6b]: Fix dangling resolver artifact by Tianyu Yao
Improvements
- [81eab03]: Remove unused fieldPath from resolver suspense objects by Jordan Eldredge
- [d982b5b]: Add feature flag to opt in/out of including the path field in @required reader nodes by Jordan Eldredge
- [460508a]: Remove path from @catch codegen by Jordan Eldredge
- [a88c013]: Derive @required fieldPath at runtime by Jordan Eldredge
- [7c9aebb]: Add support for @catch on fragments/queries/mutations and aliased inline fragments (#4838) by Jordan Eldredge
- [08fef89]: Cleanup resolver cache implementation only used in tests by Jordan Eldredge
- [2c3b915]: Cleanup AVOID_CYCLES_IN_RESOLVER_NOTIFICATION by Jordan Eldredge
- [2705e3d]: Add support for handling field errors on noncompliant lists by Ryan Holdren
- [402aa97]: Update message in handlePotentialSnapshotErrors for payload errors by Itamar Kestenbaum
- [8421851]: Improve error message when directive is used in wrong location by Jordan Eldredge
- [3eb627d]: Add fieldPath to missing data field error logs (#4835) by Jordan Eldredge
- [bac814f]: Use prefetchable metadata in the prefetchable pagination hook by Tianyu Yao
- [d079b29]: Allow @required on connection fields by Jordan Eldredge
- [733cc27]: Add schema name to project config by Monica Tang
- [ebf028b]: Use directive location where it makes sense by Gordy French
- [d3eb42f]: Don't require @alias on plural fragments spread into plural selections by Jordan Eldredge
- [e21e162]: Allow codemod to specify rollout percentage by Gordy French
- [e4facf3]: Allow granular FeatureFlag gating of
@alias
enforcement by Jordan Eldredge - [deb7b09]: Allow users to return ID built in scalar using DataID by Jordan Eldredge
- [3c92504]: Fix slow typegen in adslab by Tianyu Yao
- [6e4c120]: Update error message for clarity by Jordan Eldredge
- [5c548bd]: Allow @dangerously_unaliased on @inline fragments by Jordan Eldredge
- [2cf6c7f]: Codemod command runs and collects code actions by Gordy French
- [ad26284]: Make required-on-non-null-within-throwOnFieldError an LSP warning by Gordy French
- [b41ae4c]: Support semantic non-nullable RelayResolverValue by Jordan Eldredge
- [eba1d97]: Allow strong resolvers to reference opaque types by Jordan Eldredge
Documentation Improvements
- [9401e69]: - add new client 3D page in 3D docs by Lynn Yu
- [6a51b39]: - 3D docs starting point by Lynn Yu
- [caa040a]: - document all top level functions in relay compiler by Lynn Yu
- [1306086]: - document all top level structs in relay compiler by Lynn Yu
- [86301c7]: - document all modules in relay compiler by Lynn Yu
- [bdbe7e0]: Add rust docs for all top level enums in relay compiler by Lynn Yu
- [5600502]: - document semantic nullability support in resolvers by Lynn Yu
- [c3b0dd5]: Docs: Fix fragments tutorial thumbnail typo (#4841) by Daniel Stocks
- [5b7dc1f]: Add docs for usePrefetchableForwardPaginationFragment by Tianyu Yao
- [5cccb7b]: - adding docs for abstract types in relay resolvers by Lynn Yu
- [ebc4936]: Minor updates to docs on enabling relay resolvers (#4824) by Arthur
- [4776175]: Update docusaurus to 2.4.3 by Gordy French
- [0b4920d]: - delete old relay doc versions older than 2 years by Lynn Yu
- [b8967d2]: Add documentation for codemods (#4826) by gordyf
- [7c2b460]: Update description of dangerously_unaliased_fixme directive by Jordan Eldredge
Miscellaneous
- [9eb9c94]: Update to latest react@experimental (#4847) by Lauren Tan
- [7e258ca]: Add @relayRequiredVariables to metadata section of generated .graphql files by Jean Zhang
- [4360f69]: Deprecate GK relay_enable_load_query_request_deduping by Nithik Balachandran
- [15a19e9]: Update metadata generation for Live Query in Relay compiler by Xiangxin Sun
Experimental Changes
- [30af003]: Add a runtime feature flag for prefixing read-time resolver storageKeys by Evan Yeung
- [195d9a2]: Fix usePrefetchablePagination bug by Tianyu Yao
- [57756e6]: Allow reusing fetching options in usePrefetchableForwardPaginationFragment by Tianyu Yao
- [023b875]: Support dynamic switching of read vs exec time resolvers in reader by Evan Yeung
- [53cef9d]: Update hook to expose data in UNSTABLE_extraVariables by Lynn Yu
- [d036d49]: Update normalization artifacts for exec time resolver strong ids by Evan Yeung
- [9035b32]: Generate prefetchable pagination ASTs by Tianyu Yao
- [dececd1]: Generate metadata for prefetchable pagination by Tianyu Yao
- [4a67ddd]: Create a separate edge fragment for prefetchable pagination by Tianyu Yao
Version 18.1.0 Release Notes
Following up from our v18.0.0 release last month, v18.1.0 provides a number of fixes and improvements, adds some new experimental APIs, and ships some long-running experimental features as stable.
Relay Resolvers are now stable
For the past several years we've been iterating on Relay Resolvers which provided a structured and typesafe way to model client state and derived data in your GraphQL graph. As of this release, Relay Resolvers are enabled by default and no-longer experimental. As part of this stabilization we shipped fixes for Relay Resolvers when used with TypeScript and fixed a few edge cases related to how errors encountered by resolvers are handled.
- [d10786]: Update docs now that resolvers are stable by Jordan Eldredge
- [4e5377]: Remove Relay Resolver compiler feature flag by Jordan Eldredge
- [7b8f1f]: Remove ENABLE_RELAY_RESOLVERS runtime feature flag by Jordan Eldredge
- [1467b6]: Stabilize LiveResolverStore as the new implementation of RelayModernStore (#4806) by Jordan Eldredge
- [dec5ee]: Avoid running resolver code if root fragment throws with @required(action: THROW) (#4799) by Jordan Eldredge
- [478274]: Ensure we import the type of a resolver for RelayResolverValue fields by Jordan Eldredge
- [852fbc]: Improve edge resolver error messages by Gordy French
- [575f20]: Add satisfies type assertion for typescript (#4797) by Drew Atkinson
- [2314f4]: Document relay field logger (#4809) by Jordan Eldredge
Improvements to error @catch
We released @catch
in v18.0.0 and are very excited about the capabilities it enables. Check out Itamar Kestenbaum's GraphQL conf talk about it here: Build Confidently: How @Catch and Error Handling Pave Way in Field Nullability.
Since that release we've made a few improvements:
- Fields within a
@catch
directive that are marked as@semanticNonNull
in the schema now generate non-nullable TypeScript/Flow types. See semantic nullability. - Errors exposed to product code by
@catch
no-longer include the error message. This is because GraphQL error messages are generally not safe to show to users. These error messages can still be accessed by the field logger provided to your Relay Environment. In the future we plan to let users opt into allowing safe error messages through to product code.
- [26b78d]: Take advantage of @semanticNonNull within @catch (#4794) by Jordan Eldredge
- [6a038d]: Replace actual server-side error with generic "server error" message by Itamar Kestenbaum
- [6c8827]: Don't report missing fields within an unmatched inline fragment by Jordan Eldredge
- [2314f4]: Document relay field logger (#4809) by Jordan Eldredge
Compiler Error Reporting
We've improved how errors are reported by the Relay compiler to ensure we report as many errors as possible, and each error includes sufficient context.
- [9edbb0]: Report validation errors for all segements of a proejct by Jordan Eldredge
- [adaf8a]: Report location of operation that does not define variable by Jordan Eldredge
New "Copy Operation" VSCode command
Our VSCode extension now includes a command to quickly copy the full text of a query directly from within your editor.
- [8d2380]: Add copy operation command (#4778) by Tobias Tengler
Experimental APIs for reading fragment data outside of React
In some cases it can be useful to read a fragment outside of a React hook. However, doing this requires handling a number of concerns.
- The fragment data may not yet be ready (
@defer
or Relay Resolver suspense). - The fragment may error (
@throwOnFieldError
,@required(action: THROW)
) - The fragment's data might change over time.
To enable users to read fragment data while correctly handling these cases, we've added two experimental APIs:
observeFragment
: Read a fragment as a stream of states where each state might be loading, error, or value.waitForFragmentData
: Read a fragment as a promise which will resolve when data is available, or reject if an error is encountered.
- [6f0cbe]: Upstream observeFragment and waitForFragmentData to relay-runtime by Jordan Eldredge
- [36eecf]: Documentation for observeFragment and waitForFragmentData by Jordan Eldredge
Docs
Thanks to members of our community for submitting pull requests to improve our docs:
- [e133fe]: Remove reference to the Google Chrome Extension Store from the installation guide for Relay Developer Tools by Jakub KopÃ…â„¢iva
- [e41490]: Replace story.image for story.thumbnail (#4793) by Theo Kouzelis
- [e95a5a]: Update mutations-updates.md in Tutorials (#4765) by Jbee
- [0cf094]: Update error handling and semantic nullability docs to include talks and links (#4800) by Jordan Eldredge
Improvements
- [08c74e]: Validate semantic-non-null interface implementations by Gordy French
- [a5b963]: Renaming missing_field log event types to missing_required_field by Itamar Kestenbaum
- [186c91]: Call cleanup of insertion effects when hidden (#30954) by rickhanlonii (Meta Employee)
- [ba0b46]: Add logging for normalization by Tianyu Yao
- [792628]: Relay: Allow omitting exists on ExternalFileSourceResult by Nico Reed
- [f1ee92]: Check pruned fields blocklist for undefined fields by Steven Chaitoff
- [23958c]: Make metadata_for_machine keys string constants by Steven Chaitoff
- [8d0302]: Relay: Remove unused code from oss code by Nico Reed
- [6d36d7]: Fix mockClientData with generateDeferredPayload = true by Fernando Gorodscy
Experimental
We are always continuing to evolve and improve Relay. These changes are part of features or implementations which are either in progress or are being experimented with internally.
- [cb1b4d]: Add feature flag and config option to give custom path for artifacts by Monica Tang
- [4acf3f]: Make usePaginationFragment compatible with by Joe Savona
- [f9365f]: Attempt to avoid cycled when expanding updated ids to include impacted resolvers (#4792) by Jordan Eldredge
- [59b2a6]: UseQueryLoader() (and refetch()) compatibility with by Joe Savona
- [2f997b]: Update generated data driven dependency metadata for client 3D by Lynn Yu
- [790d46]: Update Relay API for disk caching by Evan Yeung
- [bb30bb]: Add feature flag for reader AST module imports by Evan Yeung
- [f0761b]: Add a priority flag to task scheduler for store network updates by Tianyu Yao
- [6f8f79]: Move corpus creation of program into helper function by Gordy French
Version 18.0.0 Release Notes
With version 18, the Relay team at Meta and our community of contributors have made several significant improvements to Relay:
- Improved validation of argument types
@alias
released as stable@catch
to detect and granularly handle field errors@throwOnFieldError
and@semanticNonNull
to avoid having to handle the nullability of fields which are only null in the case of error.- Intellisense for your Relay config file
- Rename refactoring tools and inlay hints for fragment arguments
Read all about them in more detail below:
Breaking Changes
Improved validation of field and fragment arguments
Previously we were not correctly type-checking arguments passed to client-defined fields, such as Relay Resolvers and Client Schema Extensions. This new release adds that validation. If you need to opt out of this validation for any reason, you can enable the disable_full_argument_type_validation
compiler feature flag.
{
// ... rest of config
"featureFlags": {
"disable_full_argument_type_validation": {
"kind": "enabled"
}
}
}
Major features
@alias fragment aliases released as stable
Aliased fragments are a Relay feature that lets you access fragments spreads and inline fragments as named properties. This can be especially helpful for fragments which might be conditionally fetched due to @skip
/@include
or type conditions which might not match. With @alias
these fragments get typed as nullable properties allowing you to check at runtime if they've matched or not before trying to use the data.
@catch
@catch
, enabled by default will let you check at runtime if a field errored. This can allow you to disambiguate between true nulls returned by your server, and fields which are null due to field level errors.
@throwOnFieldError
@throwOnFieldError
can be added to fragments and queries and will cause any field errors within that fragment/query to throw when read. This ensures that all null values you encounter are true nulls as returned by your field resolvers on the server, and not field level errors that have been coerced to null.
Read more about @throwOnFieldError
Semantic Nullability
@throwOnFieldError
unlocks a powerful new feature when combined with a schema that has fields annotated with @semanticNonNull
. @semanticNonNull
can be added to fields which have been made nullable in the schema only to enable more robust error handling, but are not expected to return null expect in the case of errors.
Within fragments or queries annotated with @throwOnFieldError
, fields annotated with @semanticNonNull
will be typed as non-nullable. This has the potential to dramatically reduce the number of null checks you need to perform inside your product code, while also making your product code more "correct" by treating all field errors as explicit errors.
Read more about Semantic Nullability
Relay Resolvers can now have access to context
Thanks for Mark Polak and Drew Atkinson from Microsoft, Relay Resolvers can now be configured to accept a shared context object, similar to standard GraphQL resolvers.
Read more about Resolver context
Ability to opt out of Relay Compiler source control integration
Thanks also to for Mark Polak from Microsoft, the Relay compiler config now supports the option "noSourceControl": true
which will ask the Relay compiler to not automatically try to add/remove files from Git or Mercurial.
Editor Integration Improvements
Thanks to Tobias Tengler, Relay's editor support now includes:
- Intellisense (autocomplete, hover tooltips, diagnostics) for the Relay config file. This fills a critical gap since the Relay config is quite under-documented. (#4724) by tobias-tengler
- Rename refactoring tools (#4581) by tobias-tengler
- Add Inlay Hints for Fragment arguments (#4740) by tobias-tengler
- Improved documentation links in errors and hover tooltips (#4741) by tobias-tengler
Additional runtime logging integrations
- [9b24ad]: Log notify stats by Tianyu Yao
- [ed8a7f]: Add logging for DataChecker by Tianyu Yao
- [462b01]: Add logging for store lookup by Tianyu Yao
- [1faea5]: Add more loggings for GC by Tianyu Yao
- [f42215]: Add more information to execute.next log by Tianyu Yao
Additional Improvements
- [e84b10]: Inline enum values in hot code paths by Jan Kassens
- [ebd987]: Strictify relay entrypoint typing by Sam Zhou
- [989ebf]: Improve error reporting for argument type errors by Jordan Eldredge
- [3ba54c]: Use more precise variance for some relay types by Sam Zhou
- [9f0e9e]: Improve schema-validation error messaging by Steven Chaitoff
- [eec960]: Report schema parsing errors for synced schema sources (#4719) by tobias-tengler
- [176f96]: Parallelize dumping schemas to disk by Deepak Singh
- [e492d7]: Fix out of date component name in Mutations & Updates by Lynn Yu
- [0f49c2]: Skip importing export types in TS (#4754) by Drew Atkinson
- [aba9e9]: Ignore null/undefined queries in entrypoints by Jordan Eldredge
- [d5f1a0]: Correctly report unaliased fragments within inline fragment with @Skip by Jordan Eldredge
- [2ad28f]: Disallow Node refetchable query on interfaces without implementations by Tianyu Yao
- [c446d4]: Fix Relay incremental build for enums by Evan Yeung
- [7998bc]: Support multiple @module fragments in the same selection if they have @alias (#4744) by Jordan Eldredge
- [df2aca]: I think we could allow @module in the same selection if they have different keys by Jordan Eldredge
- [294cb8]: Ensure we strip alias metadata from selections within inline fragments by Jordan Eldredge
- [531c6f]: Fix syntax error when using the new relay resolver by Tianyu Yao
- [6e47ac]: Return and handle all required_on_non_null_field errors by Gordy French
- [2b5028]: Ensure documents are synced before calculating completions #4473 by Jordan Eldredge
- [c43429]: Add editor support for JSON config schema (#4724) by tobias-tengler
- [4d2fe9]: Error on multiple graphql type definitions on one flow type by Tianyu Yao
- [99003d]: Prevent using @alias within @match by Jordan Eldredge
- [7491d3]: Update relay resolve API doc by Tianyu Yao
- [5d1225]: Fix incremental build when enum field argument changes by Monica Tang
- [0c5d69]: Support incremental schema change for union changes by Lynn Yu
- [d53615]: Refactor alias to always use inline fragments (and compose with other features) by Jordan Eldredge
- [86800e]: Add compiler command to emit json schema of config file by Jordan Eldredge
- [80e041]: Minor spell checking by Gordy French
- [6a2c39]: Validate that @match fields always have supported arg by Jordan Eldredge
- [7bd521]: Only validate alias within each selection set by Jordan Eldredge
- [44cbff]: Support Client Edge to Client Union for strong types by Monica Tang
- [d35688]: Avoid reading inline fragments if abstract type condition does not match by Jordan Eldredge
- [3787b8]: Handle case where @required bubbles to @Aliased inline fragment on abstract type by Jordan Eldredge
- [349334]: @required should bubble nullable to parent semantic-non-null linked field by Gordy French
- [f96121]: Allow abstract inline fragments to be omitted by Daniel Lo Nigro
- [43bd9b]: Revert D54206758: Validate edgeTypeName argument points to an existing type by Amy Hwang
Documentation Improvements
- [c54830]: Docs for @catch by Itamar Kestenbaum
- [f07f56]: Update semantic nullability docs to remove feature flag that is no-longer needed by Jordan Eldredge
- [861caa]: Fill in definitions for @stream and @stream_connection in Glossary by Lynn Yu
- [e46ba9]: Document current support for experimental semantic nullability (#4770) by Jordan Eldredge
- [642e03]: Add definitions for @LiVe and @live_query to glossary by Lynn Yu
- [27b2a1]: Document resolvers constants by Jordan Eldredge
- [175098]: @throwOnFieldError documentation by Gordy French
- [794cc3]: Pagination documentation fixes by Lynn Yu
- [23a7c2]: Fix the connection key in the mutations tutorial (#4751) by Sviatoslav Abakumov
- [bf6153]: Fix small errors in docs by Lynn Yu
- [99f4f6]: Organize sidebar for oss site by Evan Yeung
- [0ab687]: Re-organize hierarchy of docs interally by Evan Yeung
- [aa6538]: UseQueryLoader clarification by Monica Tang
- [9f314a]: Fix GraphQL Field name for story thumbnail examples by Jerry Francois
- [285dc2]: Spelling and capitalization by Gordy French
- [0e57c3]: Fix unclosed jsx tag by Monica Tang
- [7fccac]: Fix minor typo in editor-support.md (#4721) by SY Ryu
- [c632b4]: Link to Relay website @defer @stream docs by Monica Tang
- [d61ce0]: S/class/className/ in MDX (#4716) by Paul O’Shannessy
- [98d76c]: Add instructions to run relay compiler after query update (#4718) by Matthew Pawley
- [dbae5c]: Link GQL node definitio...
Version 17.0.0 Release Notes
Since our last release in January of this year, we've made many improvements to Relay. Themes include:
- Improved correctness checking and validation
- Additional editor features
- Experimental features exploring error handling and nullability
Breaking Changes
Schema Validation
Relay compiler now runs spec-compliant schema validation against your schema including client schema extensions and Relay Resolvers. You can opt out of this feature by disabling validation in your Relay compiler config.
// relay.config.json
{
//...
"featureFlags": {
"disable_schema_validation": true
}
}
[ccc4465] by Jordan Eldredge
Edge Type Validation
We now validate that the names passed to directives like @prependNode
and @appendNode
are valid typenames. You can opt out of this validation with the following feature flag in your compiler config:
// relay.config.json
{
//...
"featureFlags": {
"disable_edge_type_name_validation_on_declerative_connection_directives": {
"kind": "enabled"
}
}
}
[53b2436] by tobias-tengler
Bug fixes
- [f87e77d]: Fix MockPayloadGenerator for deferred fragments in lists by Fernando Gorodscy
- [24b557a]: Use default values from mock resolver for Relay 3D payload by Andrey Lunyov
- [59ff9c1]: Mark resolves as clean again if we reread their fragment and find data unchanged by Jordan Eldredge
- [0d7a3d0]: Input fields with defaults shouldn't be required (#4647) by Graeme Coupar
- [7cc4f2b]: Check if condition on defer/stream fragments by Fernando Gorodscy
- [05d64cc]: Update GraphQL parser to consume escaped characters by Monica Tang
- [448aa67]: Fix Flow Types in RelayObservable by Jerry Francois
Improvements
Runtime Improvements
This release includes a new implementation of our hooks which are significantly more efficient in terms of memory use. Thanks to Dave McCabe for his work on this huge project.
- [9f03ea5]: Make new useFragment implementation the default by Andrey Lunyov
Editor Integration Improvements
Huge shout out to community contributor Tobias Tengler for many improvements to our Editor Support via our VSCode extension. Our VSCode extension is powered by the relay-compiler
so upgrading to version 17.0.0
of the compiler should unlock a number of great IDE features.
- [dc2cb85]: Add code action to rename fragment (#4697) by tobias-tengler
- [68c7cca]: Add SchemaDocument go to definition LSP support (#4669) by tobias-tengler
- [8fd21e7]: Attach previous location to duplicate type diagnostic by Jordan Eldredge
- [dd9d3a0]: Support inlay hints by Jordan Eldredge (Requires upgrading to v2.3.0 of our VSCode extension)
- [964e078]: Activate LSP for schema and schema extension files (#4652) by tobias-tengler
- [bb41169]: Support go to definition for arguments (#4605) by tobias-tengler
- [bbddbf3]: Report errors if location provider fails (#4588) by Jordan Eldredge
- [964e078]: Activate LSP for schema and schema extension files (#4652) by tobias-tengler
Compiler Performance Improvements
- [232985f]: Parallel watchman queries for saved state and changed files by Gordy French
- [ef22ae6]: Run schema validation in parallel by Jordan Eldredge
- [a7984bc]: Speed up
watchman_query_time_before_subscribe
by Tianyu Yao - [acd17ec]: Use multithreaded zstd compression by Gordy French
- [a7984bc]: Speed up
watchman_query_time_before_subscribe
by Tianyu Yao - [f7b030e]: Split a project into multiple chunks and parallelize by Tianyu Yao
- [bafd56b]: Parallelize GraphQLAsts::from_graphql_sources by Tianyu Yao
- [69dbfee]: Parallelize from_graphql_sources_map by Tianyu Yao
- [ce12ecf]: Parallelize building schemas by Tianyu Yao
- [586483e]: Parallelize from_file_source_changes by Tianyu Yao
- [ee8523f]: Implement SchemaDocument path resolution (#4639) by Tobias Tengler
- [5f1eb8a]: Add path resolution for fragment arguments (#4651) by tobias-tengler
- [6601a35]: Speed up LSP requests outside of GraphQL by Evan Yeung
- [a5a7947]: Incrementally build Enum schema changes by Evan Yeung
- [ce6ea74]: Add go to definition support for type defined in variable definition (#4629) by tobias-tengler
- [2ba726b]: Add go to definition support for directives (#4625) by tobias-tengler
Misc. Improvements
- [29d9e55]: Add
preferFetchable
argument to the @refetchable directive by Andrey Lunyov - [f45b35f]: New feature flag that will allow to opt-out @fetchable types from the
node
query generation in @refetchable by Andrey Lunyov - [9958e56]: Print raw response on persisting parsing error by Tianyu Yao
- [9cf21af]: Integrate with Sapling or Git if they exist (#4691) by Jon Janzen
- [badd538]: Migrate relay hooks to hook-syntax by Alex Taylor (alta)
- [349b5a8]: Use client schema extension enum values as source of truth for Flow types by Jordan Eldredge
- [d3c8d1c]: Add feature flag for fragment arguments (#4648) by tobias-tengler
- [9e9428e]: Add support for ENABLE_RELAY_OPERATION_TRACKER_SUSPENSE flag in the the new hooks implementation by Andrey Lunyov
Documentation Improvements
- [acb227a]: Fix search on relay.dev (#4715) by Paul O’Shannessy
- [6b91a2e]: Improve compiler explorer (#4698) by Jordan Eldredge
- [4c5cd41]: Add docs for
preferFetchable
argument by Andrey Lunyov - [95010c8]: Relay: Update Obsolete Docs Reference to
ReactTestUtils
by Tim Yung - [51a82f6]: Document Relay Resolvers (#4547) by Jordan Eldredge
- [ff8e80d]: Update docs to clarify behavior of refetchable variables with nullable fragment reference by Jordan Eldredge
- [76d6d77]: Demonstrate using custom scalar to replace RelayResolverValue by Jordan Eldredge
- [05cf065]: Fixing minor typo in website (#4673) by Jeshuran Paul
- [906f5ed]: Relay docs: Fix shell script getting Prism'd as a JS comment by Robin Giese
- [0109168]: Relay docs: Tutorial page should have proper title by Robin Giese
- [ea2cbbc]: Fix typos in the Relay Resolvers docs by Evan Yeung
- [dc36b48]: Fix typos in tutorial by Monica Tang
- [14314f9]: Escape asterisks in README.md (#4635) by Chris Morin
- [ee03182]: Fix(docs): add instructions about installing watchman if necessary in the tutorial (#4620) by Mark Feng
- [1256e73]: Remove CodeSandbox Example by Jordan Eldredge
- [b7f59af]: Chore(doc): improve relay compiler doc for persist (#4608) by eMerzh
- [8e557f9]: Fix typos (#4597) by Kenneth Lum
- [615c2d2]: Fix(doc): update config name following update (#4596) by eMerzh
Experimental Changes
We are also continuing to evolve many experimental features which are not yet stable enough to be enabled by default in Relay.
Relay Resolvers
Relay Resolvers have been extended to support defining types which implement interfaces, and define resolvers that return client-defined interfaces where all implementing types are defined using Relay Resolvers. Relay Resolvers are now stable enough to have full documentation with instructions on how to enable them.
- [ba5e48f]: Add model resolvers for interfaces by Monica Tang
- [55b8716]: Return an interface with multiple weak concrete types from a resolver field by Monica Tang
- [46879b4]: Multiple weak models implement an interface by Monica Tang
- [98823ea]: Add model resolvers for unions by Monica Tang
- [245602f]: Remove allow_legacy_verbose_syntax ParseOption by Lynn Yu
- [cdab89f]: Remove ENABLE_CLIENT_EDGES runtime feature flag by Jordan Eldredge
- [b26f3be]: Remove @outputType feature flag by Monica Tang
- [7ce13bc]: Remove LiveResolverStore from experimental export namespace by Jordan Eldredge
- [f193cda]: Invert the default for emit_normalization_node_for_client_edges by Jordan Eldredge
- [0cac319]: Define resolver on interface with weak types by Monica Tang
- [6bda98c]: Make interface model resolver fields compatible with client schema extension-defined concrete types by Monica Tang
Additionally, we are exploring the ability to extract Resolver type and field definitions directly from your typed JavaScript code, similar to how Grats works. This work is still highly experimental, only supported for Flow, and not yet fully functional. If you are interested in working with us to help bring this support to TypeScript, please get in touch. - [722b18f]: Better error message for using an optional flow type for strong objects by Tianyu Yao
- [4267075]: Implement schema generation for weak object fields by Evan Yeung
- [5d2fa70]: Prevent docblock parsing error for new resolver syntax in LSP by Tianyu Yao
- [36802d9]: Properly support nullable strong return type by Tianyu Yao
- [8e5c565]: Add "description" to Flow schema generation by Evan Yeung
- [7e41583]: Fix passing empty documents to schema gen by Tianyu Yao
- [8cce449]: A RelayResolverValue generic by Tianyu Yao
- [0d1b5c2]: Add argument support for Flow schema generation by Evan Yeung
- [95aaa48]:
IdOf<>
return type by Tianyu Yao - [5052062...
v16.2.0
Minor breaking changes
- [4e68155d732b]: Reuse TypegenConfig for SingleProjectConfigFile (#4585) by tobias-tengler
This change is a breaking change, as the customScalars
config option in the single-project config must now be specified as customScalarTypes
.
Added
- [40fe615ad6f8]: @preloadable Support (#4515) by tobias-tengler
Bug fixes
- [b995eec40461]: Update config.ts for typo (#4594) by Orta Therox
- [2f9e88affdc7]: Fix goto references for TerseRelayResolver (#4587) by tobias-tengler
- [d513e42f881e]: Suspend on active promises for client edge queries in the new hooks implementation by Andrey Lunyov
- [eb0b7fcd991c]: Cleanup outdated records after model/output type resolvers updates by Andrey Lunyov
- [ece1fd953b98]: Fix SDLSchema replacing logic by Deepak Singh
- [d90dedfc577e]: Replace invariant in SuspenseResource with the warning in the case where GC is disabled by Monica Tang
- [9f135b8f92a7]: Fix path on Windows (#4544) by martin
- [aac57b30e812]: UseFragmentInternal should suspend if environment changes and there is a query in flight by Andrey Lunyov
- [00aabd00be72]: Fix client->client nullable model issue for PluralConcrete object output types by Monica Tang
- [7b3b0779b570]: Fix client->client nullable model issue for SingularConcrete object output types by Monica Tang
- [3873809c2df8]: Handle missed updates from the low-priority state changes in the new hooks implementation by Andrey Lunyov
Improvements
- [0037d05c61d8]: Cleanup allow(unused_imports) by Cameron Pickett
- [ada971e33838]: Disallow some read time features in mutation responses by Jordan Eldredge
- [a2c7ed480e2d]: Relay-compiler diagnostic errors logging improvements (#4574) by Alex Coleman
- [1a57f0832665]: FIX(Graphql): Add support for input with default values (#4540) by eMerzh
- [2f97f25e53a1]: Consume LiveState from relay-runtime root in typegen by Jordan Eldredge
- [182a86647000]: Fix missing space in diagnostic location print (#4573) by Alex Coleman
- [5a18984e4155]: Refactor model resolver codegen to re-use build_reader_relay_resolver by Monica Tang
- [1972913c2d12]: Augment corpus digraph logic to intake a vec of TextSource by Monica Tang
- [06cb092ae28f]: Implement compiler command to get graphql text sources and program by Monica Tang
- [1a06f3269985]: Use
Parameters
and indexed access type to extract PreloadParams by Sam Zhou - [5cf0af11be92]: Update print_schema to support ARGUMENT_DEFINITION and INPUT_FIELD_DEFINITION directives by James Wren
- [4c25549bcb1a]: More strict selectors equal check by Tianyu Yao
Documentation Improvements
- [8392b68a5137]: Document
directives
argument for@refetchable
(#4520) by Daniel Lo Nigro - [8ef4b47e69d0]: Document current behavior of server edges returning null by Jordan Eldredge
- [361d0b3fae9f]: Typo fix (#4561) by Randall Bennett
- [921f2a8715a1]: Fix(docs): normalize local data updates doc (#4564) by Guilherme
Miscellaneous
- [4619f9706d97]: Add a json output option by Tianyu Yao
- [49e4da17abbc]: Make compiler results seriaizable by Tianyu Yao
Experimental Changes
- [5718ca9fd9b2]: Transform to convert fragments and linked fields on abstract types to inline fragment by Monica Tang
- [399bf9201eba]: 6/n - Add tests for errorResponseFields by Itamar Kestenbaum
- [27a062376ce3]: 5/n - Add erroring on seeing relayFieldErrors by Itamar Kestenbaum
- [12d169fc9c23]: 4/n - Add logging on seeing relayFieldErrors by Itamar Kestenbaum
- [0a9d473edeee]: 3/n - Add RelayFieldError and rename RelayFieldError to TRelayFieldError by Itamar Kestenbaum
- [914794c4ddba]: 2/n - Rename requiredFieldLogger to relayFieldLogger by Itamar Kestenbaum
- [af4afbdc2ab3]: 1/n - Add field errors to Snapshot by Itamar Kestenbaum
- [08c32cfede3b]: Integration test for resolvers implementing fields for interface by Jordan Eldredge
- [396a1dbfb8cd]: Expose live resolver modules outside of experimental-live-resolvers directory by Jordan Eldredge
- [bac5f9c790a9]: Update for normalization node changes by Bhuwan Khattar
- [8dd004f4711a]: Add apply_to_normalization_ast config for resolvers_schema_module by Bhuwan Khattar
Full Changelog: v16.1.0...v16.2.0
v16.1.0
Added
- [b683e8c2c355]: Add validations for custom scalar arguments by Alex Danoff
Enable flagenable_strict_custom_scalars
to perform validations when custom scalar types are used, to check that the user doesn't try to pass literal values (strings, ints, etc) in positions where a custom scalar type is expected, as this can break type safety since Relay can't know whether those literals conform to the underlying custom type.
Bug fixes
- [b379edf30a6e]: Handle the document type change from Query to Fragment by Andrey Lunyov
- [5ffcdbcf0114]: Fix missing validation for global variables in client-edges (#4513) by Andrey Lunyov
- [8e0949d6d90a]: Apply fragment renaming to resolver fields by Jordan Eldredge
Improvements
- [dfad61878904]: Fix types in RelayMockPayloadGenerator.js by George Zahariev
- [24ef22b4946c]: Adopt conditional type for useRefetchableFragment related functions by Sam Zhou
- [400cfa841445]: Refactor extra typegen config fields into TypegenOptions struct by Monica Tang
- [e694ba8792a6]: Use conditional type to power
EntryPointElementConfig
by Sam Zhou - [1cc9d937ea1a]: Refactor extra artifact project config fields into extra_artifacts_config by Monica Tang
- [cf0fb394dbb6]: Incremental build compatible ResolversSchemaModule by Bhuwan Khattar
- [0d429f796e69]: Implement fmt::Display for SchemaChange by Monica Tang
- [d48a0e025385]: Fix RelayResolverModel-test by Monica Tang
- [ab92df525948]: Use placeholder in connection warning by Jan Kassens
- [6519571a092a]: Shallow freeze resolver value by Tianyu Yao
- [7f54255c92ea]: Do not mutate a shallowly frozen subtree by Tianyu Yao
- [904924c6925b]: Add validations for mutation resolvers by Alex Danoff
- [ef84550353b6]: Handle panics in integration tests by Alex Danoff
- [5c7555b2c00d]: Expose Sink type from relay-runtime (#4516) by jaroslav-kubicek
- [9e0acc1d8c77]: Improve test coverage for recycleNodesInto on deeply frozen data by Tianyu Yao
- [6b89a29678ad]: Add normalizeResponse to MultiActorEnvironmentConfig by Bhuwan Khattar
- [61c7bffac76f]: Regression test for mutating complex resolver values by Tianyu Yao
- [22a3c89f9518]: Import ClientRequest for client only mutations by Alex Danoff
- [3017057e77eb]: Only freeze plain JS objects and arrays by Tianyu Yao
- [f90edc4cb52a]: Add regression test for fragment spreads with undefined global variables as arguments by Monica Tang
- [8011e22b6043]: Add areEqualOwners to check for structural equality of fragment owners. (#4500) by Andrey Lunyov
Documentation Improvements
- [e854fa04acfe]: Typos (#4532) by Michael Letcher
- [06756209a4aa]: Fix typo in website/docs/tutorial/queries-1.md (#4522) by Priyansh Agrawal
- [59f5d604bb43]: Fix typo in Relay Mutations & updates doc by Mingshi Yang
- [a0b50ac400b4]: Add graphql operation naming and organization docs by Aaron Lichtman
- [19970477942d]: Add blog post explaining how Relay provides unique value in data loading by Jordan Eldredge
- [4668757a37e9]: Add back updating-connections to current doc by Tianyu Yao
Miscellaneous
- [2863820b5000]: Export fragment type generation for FCL setup by Monica Tang
- [4712bcc92e85]: Replace uppercase React import with lowercase one by Sam Zhou
Experimental Changes
- [cf30bf4a3561]: Upstream resolvers_schema_module from fb-relay-compiler by Bhuwan Khattar
- [05689b07f341]: Js_module_import_path -> js_module_import_identifier by Bhuwan Khattar
- [a2c57d988bc2]: Consolidate __relay_model_instance definitions by Monica Tang
- [4f7739ac3363]: Generate_schema_resolvers -> ResolversSchemaModule by Bhuwan Khattar
- [400090b0ad8a]: Make LiveState and suspenseSentinel top level exports of Relay by Jordan Eldredge
- [07a90ee56ab5]: Repro tests for resolver client edges to nullable models by Monica Tang
- [5bbdfc92cd35]: Generate rootFragment normalization ast for schema_resolvers by Bhuwan Khattar
- [70a5ff0b15c9]: Always pass an args object to resolvers that define runtime args by Jordan Eldredge
- [3ee60181ff50]: Inject
useFragmentInternal
to use inuseLazyLoadQueryNode
by Andrey Lunyov - [aa64b588fff4]: Unsubscribing from resolvers before removing the record while runing the garbage collector by Leonel Fernandez Mir
- [44227353d574]: Validate that field arguments passed to relay resolvers are defined by Monica Tang
- [930864a33ede]: Deprecate verbose resolver syntax with feature flag to enable by Jordan Eldredge
- [86dc27050b26]: Add regression tests for undefined fragment arguments in relay resolvers by Monica Tang
- [00d621701622]: Add regression tests for undefined field arguments in relay resolvers by Monica Tang
- [41a33a19331f]: Add regression tests for both field and fragment arguments in relay resolvers by Monica Tang
- [0c70e547f27b]: Update normalization AST generation by Gerard Moreno-Torres Bertran
v16.0.0
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] anduseMutation
[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 usehermes-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
andundefined
(T | null | undefined
) instead of (T | null
). To keep the old type generation behavior for now, you may set thetypescriptExcludeUndefinedFromNullableUnion
feature flag in therelay-compiler
config as follows.Note the feature flag will be removed in a future release. [cc47bc9] (#4380)- Update: We will leave the feature flag available indefinitely, or until we have an explicit solution to missing data. See this issue for more context.
{
"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:
- [94745ee] - fixing guided tour page
- [cba7764] - update fragment tutorial documentation (#4292)
- [007eff0] - Link to persisted queries in tutorial (#4359)
- [51fee15] - Fix TypeScript before continuing in tutorial (#4355)
- [97cedbc] - Rerun relay compiler (#4288)
Other corrections:
v15.0.0
Relay 15.0.0 Release Notes
Breaking
- [6092ddb] Change signature of missing field handlers. Instead of accepting a
Record
(which is an untyped grabbag containing whatever the store has), we instead pass a?ReadOnlyRecordProxy
. Furthermore, we replaceNormalizationLinkedField
withCommonLinkedField
, which both aReaderLinkedField
andNormalizationLinkedField
"implement". - [Flow-Only] usePreloadedQuery, useQueryLoader, useRefetchableFragment, usePaginationFragment, useBlockingPaginationFragment. Updates in runtime, React APIs for better integration with Flow: and a first class support for types in
flow
forgraphql
tags. [a75a445] [ef29f06] [78bd12d] [614c747] [ab9f04a]
Features
- Editor Integration. Our VSCode Extension is powered by tight integration with the Relay compiler. The following compiler improvements improve the experience of using the VSCode extension:
- [a6eb291] Find field references for vscode extension
- [96c7193] Feature: LSP Fragment completions (#4134)
- [50266e1] Warn on deprecated field and directive args
- [8f1d9be] Feature: Nested input type field completions (#4148)
- [cbdec0b] Add recursive implementing objects method
- [d24c295] Show schema field description in LSP hover
- [298af34] Document __typename and __id in LSP hover
- [c62cad9] Fix LSP completion icon for fields (#4131)
- [7c06b6c] Fix: Field alias completions (#4135)
- [233d41b] Add error reference link for unknown field error
- [3b40fe5] Improve scoping of diagnostic location for duplicate queries/fragments
- Improvements for Open Source contributors:
- [Experimental] Support of fragment argument syntax currently being proposed for the GraphQL spec
- [b497aa3] Add spread arguments to Relay Compiler AST
- [Experimental] Relay Resolvers. A significant portion of our development effort since our last release has gone into developing Relay Resolvers (a mechanism for exposing derived data in the graph) and Relay Live Resolvers (a mechanism for exposing non-Relay client state in the graph). While the features are still experimental and not documented for public use we’ve made significant progress. Some highlights:
- [9d3a87d] Ability to define multiple resolvers per-file
- [8dc927f] Terser syntax allows defining most resolvers with a single line docblock
- [3a151b4] Model resolvers allow defining new GraphQL types that are backed by JS objects
- [2e134d9] Retain Relay Resolver data during GC
- [fb96666] Support resolvers that return plural
@weak
objects - [2bd9788] Support defining
@weak
types in docblocks - [f5467f2] Allow live Resolvers to be batched
- [cb052fc] Clean up go to definition for resolvers
- [dae3159] Fix LSP on Windows (#4160)
- [e80d6ba] Compact GraphQL query text (#3983)
- [e64db9b] Allow passing custom headers when persisting queries (#4066)
- [44fe2bc] Don't print "default" project name in diagnostics
- [10e20cc] Update types for LoadMoreFn: use variables directly, do not extract them from query
- [8a44673] Adding support for client extensions in mock payload generator (#4030)
- [9393fe5] Use relative to fragment location path for provided variables modules
- [6acd8cb] Support
import type
for named imports in typescript - [c0d0198] Handle missing fields in readUpdatableQuery/Fragment
- [d00df58] Add support for refetchable interfaces
- [f070bc1] handle removed schema files in the incremental mode
- [bdf1a41] Fix validate_selection_conflict and enable the optimization in relay
- [ac5f397] More updates to LoadMoreFn types in custom pagination hooks
- [bd0c22a] Log event when we find an operation to suspend on
- [2e449af] Sort CustomScalarImports in runtime artifacts
- [470a5fb] Add SDLSchema.get_unions() (#4036)
- [aa261bf] Provide default to loadQuery TEnvironmentProviderOptions TParam
- [8eea4aa] Improve error messages related to @refetchable
- [1802a7d] Emit forced type assertions for ESModules
- [872a64f] Sort types of interface when generating selections for abstract @outputTypes
- [051d1c4] Add non-fatal validation warnings to Relay's compiler
- [4cea5dd] Add TRawResponse type to ClientQuery
- [f8c1c2d] Report related locations in diagnostics
- [bcf7d6f] Use
import type
in typescript for all imports (#4029) - [831fa90] Upgrade to Flow 0.201.0
- [96df067] Export ProfilerContext in react-relay (#4049)
Bug Fixes
- [9790484] BUGFIX - pop errors in validate_selection_conflict
- [6f248f1] Manually fix LTI errors
- [196a57b] Fix bug where resolved promise was being reused
- [9582ec7] Support Suspension of ReactRelayQueryRenderer
- [121903d] Default FetchPolicy for Live Queries to "store-and-network"
- [8d49006] Add
assignClientAbstractTypes
to the DataChecker - [68b6846] Fix suspense for client-only fragments that contains suspensible live resolvers
- [8c11098] Fix schema name resolution
- [3cb0415] ProvidedVariables and RelayResolver
- [5799146] fix moduleImportConfig support for single project configs
- [585ad64] Quote key in literal object argument
- [5ea0fb9] Do not use path in snapshots, they are different on windows. (#4101)
- [4bc0571] Fix printing nested condition nodes
- [85ab73f] Fix types of useRefetchableFragment/usePaginationFragment for data/variables with/without optional keys.
- [5028b31] Strip extensions on file import paths when writing out TypeScript generated code (#4057)
- [976e6ee] Modifying @relay_test_operation to write metadata for client fields (#4047)
- [e2a7e96] Fix printing repeated conditions
- [ce5e1ed] Compiler incorrectly reports missing required fields (#4123)
- [4ba3fe8] Import fragment types in typegen in non-haste setups
- [54ba473] Fix duplicate field validation
- [6d01338] Fix scheduling bug that caused extra queries
- [4d12002] Stop generating
js
fields in query for 3D when local import is enabled - [39c774b] Don't treat generated fragments as dependencies
Misc
v14.1.0
Relay v14.1.0 adds improvements for existing relay features - primarily fixes and feature compatibility for client extensions and @inline
. Thanks to our open source contributors who helped us release the Relay VSCode Extension!
Added
[cefab9e] Support for @required
and client-edges
[90ccda1] Support @argumentDefinitions
in @inline
fragments (#3935)
[8adcfab] VS Code: Find references of the Resolver field.
[b965299] useClientQuery hook
[7d5cc34] Add support for resolvers without fragments
[8db002f] Support custom scalar arguments that are passed as literals
Fixed
[a5d67d6] Add resolvers to the dependency graph (Fix missing resolver fragments in incrmental mode and VS Code)
[57f96a1] Improve error message when you mix up @live
and non-live values.
[c4dbd26] Remove .js
and .ts
from require / import (#4002)
[cd1e9ae] Fix MutationHandlers on field with args
[7e6dbdd] Ensure only one implemntation on interface
[055908f] VS Code: Fix comment blocks to recognize the embedded language inside of a JS file. (#4001)
[6a9b0e5] Performance optimizations in the validate_conflicting_selections
[fa5a3ba] Explicitly enumerate unsupported ReaderNode types
[9990e6f] Disallow default values on resolver fields
[d42bb7c] VSCode extension pathToRelay doesn't allow relative paths (#3969)
[a86323f] Validate conflicting selections in client fields
v14.0.0
What's Changed
Breaking Changes
- [8bb7478] Removed compiler CLI arguments:
src
,schema
,artifactDirectory.
This simplifies the public API of the compiler. The error message should print helpful message with possible config file, that can be used instead of theseCLI
arguments. - [44d6887] Relay Compiler: Make
language
configuration option required. In v13, we have default language asflow
(or Javascript with Flow comments) for reading and generating artifacts. Majority of the projects in OSS, however, usetypescript
- in order to detect which language (typescript, JS, or flow) is used in the project we will use this option. - [ed53bb0] New compiler validation: Disallow
__typename
in fragments on query. - [20626f2] Make
__typename
selections within concrete linked fields have a string literal type, instead of the typestring
. - [48ed515] Removed legacy exported type names from generated files.
typegen_phase
have been removed from the Relay compiler config.
Added
- Relay VSCode Extension by @tbezman / collaboration with @captbaritone. Starting with #3858.
- Please see: https://github.com/facebook/relay/tree/main/vscode-extension#readme for detailed information and installation instructions.
- Relay Provided Variables
- Provided variables allow populating a variable with a user-defined function. Unlike normal variables, provided variables are automatically defined for all operations that use them, allowing developer to avoid tedious updates to all the queries that might reference a fragment using the variable. This is helpful for global values such as configuration flags or device settings (pixel ratio).
- More: https://relay.dev/docs/api-reference/graphql-and-directives/#provided-variables
- Experimental: Relay Typesafe Updaters
- New Experimental APIs for updating local data:
readUpdatableQuery_EXPERIMENTAL
andreadUpdatableFragment_EXPERIMENTAL
- For more details see FAQ: https://relay.dev/docs/guided-tour/updating-data/typesafe-updaters-faq/#what-is-typesafe-updaters
- New Experimental APIs for updating local data:
- Experimental: Relay Resolvers
- Relay Resolvers is an experimental Relay feature which enables modeling derived state as client-only fields in Relay’s GraphQL graph. For more details see https://relay.dev/docs/guides/relay-resolvers/
- [901d657] Relay Compiler: Add JavaScript language to Relay Compiler Configuration.
- Please see: https://github.com/facebook/relay/tree/main/packages/relay-compiler for the list of supported compiler configuration options and CLI arguments.
- [1244359] Support for client-only queries.
- [80a66c9] Support query variables in
@inline
fragments (#3933). - [271a162] Support CommonJS for
@no_inline
(#3923). - [9e71765] Add new enum
CustomScalarType
to represent custom scalar types in the Relay compiler configuration. - [e73b95f] Add new option to support compiling a single project (#3868).
- [2a9f17f] support
sha256
andmd5
for local file persister (#3878) - [5e3c7b6] Build linux arm64 (#3882).
- [23b4cac] Expose Relay schema Extensions (#3859).
- [f199ede] Relay Compiler: Enable updatable fragments.
- [58b335e] Relay Compiler: Allow single project configs to specify feature flags (#3840).
Fixed
- [e8c9ffe] Relay Compiler: make LocalPersister include trailing newline (#3938)
- [384315d] Report schema location for invalid types (#3924).
- [141ef0f] Avoid bug where watch mode can get stuck in invalid state (#3922).
- [c48bda9] Ignore BOM when lexing (#3908).
- [6cff97d] declarative_connection: allow interfaces or objects.
- [52af6a6] Don't flatten fragment spreads with differing directives
- [5a9d42e] Fix incorrect type generation with
@required
on plural fragments. - [739009f] remove DEPRECATED_GraphQLSubscriptionConfig type.
- [928728a] Relay Compiler: Detect cyclic
@inline
fragments. - [eb0fc26] Hooks: Fix useMutation inFlight race condition (#3841).
- [2101a79] Relay Compiler: Sort locally persisted operations (#3835).
- [9f0dea4] Relay Compiler: Sort unions conditionally.
- [b04b2b7] Sort object members in type generation (conditionally) (#3808).
- [bb7c65f] Relay Compiler: Handle spaces between
graphql
tag and template. literal.
Improvements/Misc
- [9556f2f] Persist explorer state in the URL/local storage (#3930).
- [dd48057] Performance optimizations in selection conflicts validations.
- [bb8721f] Quote key names in complex type field argument literals.
- [4e2030f] Add FAQ page to docs.
- [c6ecd52] Print fragment variables.
- [7b6e7f5] Track directives on argument definitions.
Full Changelog: v13.2.0...v14.0.0