Breaking
- Change missing field handlers for “linked” fields to treat null as null. Previously, returning either null or undefined indicated that a value could not be determined, and there was no way to indicate that the field value should be set to null. To indicate "no value can be provided", return undefined instead (f106ca0)
Added
- New Declarative connection mutations: we added several directives to make common store updates in mutations easier. An updater is no longer required for following cases: @deleteRecord (applied to a field of type ID) will delete the record with the given id from the store. @appendEdge and @prependEdge (applied to a connection edge field) will append or prepend the edge to the listed connections (07ccab7, 687d89b, 2719324)
- Precise type refinement: gated by RelayFeatureFlags.ENABLE_PRECISE_TYPE_REFINEMENT. With this feature enabled Relay more accurately models GraphQL semantics around inline fragments and fragment spreads which have a different type than their parent selection. This helps Relay to more accurately determine if a query can be fulfilled from the cache (ie with the ‘store-or-network’ fetch policy) and also more accurately determine if data is missing and that a component should suspend. Generally speaking, the change is observable as fewer false positives where Relay thinks data is “missing” when it isn’t. This feature will be enabled by default in a subsequent release; we recommend enabling it now. (00985e1, 11bf467, ef93983, 1e0dba0, 3318719, f7ba970, 08ba6f0, 7c67b47, 2cf9ac9)
- Warn if a single GraphQL response contains conflicting values for a given field on the same entity (same DataID) (87520d3)
- Optimize RequestIdentifier. Previously if the query was not persisted this used the full query text, now a hash of the query is used instead (a3acc08)
- Enable parsing of Flow enums (bcd7a81)
- Add the referenced DataIDs in the store.gc log event (adb64b7)
- Garbage collection is now yieldy: the GC mark/sweep yields after processing each unit, restarting if a write to the store occurs (687e332)
- PreloadableQueryRegistry is moved from experimental to relay-runtime (6fe4323)
Fixed
- Fixed fatal in joinArgumentDefinitions (85b44e7)
- Generate a static storageKey on field nodes for lists and objects whose values are all static (34b1dc0)
- Fix @refetchable query generation for interfaces without own id field (d307b37)
- Avoid a memory leak that can occur in some JS runtimes where Error objects can retain data on the call stack until its stack property is evaluated (2859aa8)
- Fix bug with treatMissingFieldsAsNull flag and client extensions (5085aea)
- Fix a memory leak (8c1e91b)
Misc
- Added internal utility types PreloadPropsOf and VariablesOf (796950e, f1f784f)
- Use isMountedRef internal hook in query and EntryPoint loaders (61c8627)
- Emit LogEvents for Store publish/notify (60b339b)
- Flow updates: add codes to error suppressions, don’t mix import/require in flowtests (fba7930, 232dd95)
- Removed unused request parameter in ResponseNormalizer options (651ced5)
- Make RelayError messages parameterized (0e72854)
- Print the @defer and @stream directives last (this helps with parity between the JS and Rust compiler output) (7271283)
- Run the SkipRedundantNodes transform on SplitOperation nodes (used for data-driven dependencies) (1bc049e)
- Sort test metadata object keys (9a5cd5c)
- Use scheduler to schedule consistency updates outside of QueryExecutor (8af3355, 315bcf9)
- Fixed spelling mistakes: (564310d, c472ba3)
- Cleanup unused code: (fba7c8a, 92b110b, 56dc1d6, 681f0cd, a9cbabe, 37ae1e7, 292b1e8, 8bb5809)
- Update generated label for defer/stream nodes (2ae19c3)
- Sort keys of objects appearing as default values in arguments (3b8a288)
- Remove plural: false metadata in generated artifacts (487016f)
- Sort type spreads in the generate id transform (3de995a)
- Sort metadata on generated artifacts by key (bf5484c)
- Remove nonStrictEnums setting for defaultValues (78847c6)
- Sort argumentDefinitions in queries generated by RefetchableTransform (c4ec34b)
- Add environmentProviderOptions to PreloadedQuery (2365b01)
- Remove unused type in argument definitions (812e0f4)
- Sort fragment arguments, updated artifacts (b065ae2)
- Remove number of arguments check for fetch queries (9e29299)
- Generated ID fields now have the
type
from the schema (b63815b) - Rename cacheTime property to fetchTime (57719cc)
- Remove unused fragmentRefPathInResponse argument (251703e)
- Ensure cursor/count metadata check is limited to extraVariables in getPaginationVariables (84565d4)
- GenerateTypeNameTransform generates non-nullable String type for __typename (b128d82)
- Fix check for whether a type is client type (1ccf069)
- Fix printing indentation of conditions (cdd2c47)
- Apply fragment arguments on Defer/Stream node (8d8ba8b)
- Remove ValidateServerOnlyDirectivesTransform from IRTransforms (9593d57)
- Remove
label
arg from @stream_connection (2e2be4c) - Strip compiler-only metadata from generated files (2299878, fddd31b)
- Also create a proxy for executeWithSource in RelayModernMockEnvironment (8b3df8c)
- fetchQueryDeduped accepts a RequestIdentifier instead of an OperationDescriptor (041c6ec)
- remove type condition from @defer fragments (23300a9)
- Add
onLoad
support to PreloadableQueryRegistry (8242adc)
Experimental
- New useQueryLoader() and useEntryPointLoader() hooks for loading queries and EntryPoints from a component. These hooks wrap the internal loadQuery() and loadEntryPoint() APIs to manage the lifecycle of returned resources (ie, disposing the resources when the component un-mounts) (676660d, f512c9f, c819d41, d64fe26)
- Misc
- Relay Hooks: useDebugValue to show fragment/query values (e913579)
- Expose networkCacheConfig in preloaded query references (605ac7f)
- Handle case where loadQuery result is rendered under a different environment (08bb2d2)
- Don't expose preloadQuery from relay-experimental (d1c8cb5)
- Remove PreloadableQueryRegistry from relay-experimental (not a public API) (52ccd26)
- prepareEntryPoint returns void and is deprecated (a5534ea)
- Removed (internal) variant of PreloadedEntryPoint (09b8236)