Releases: facebook/relay
Releases · facebook/relay
v0.8.0
- Added a React Native / Relay TodoMVC example app.
- You can now render multiple Relay apps at once, each with their own store.
The following APIs are early versions and are as of yet undocumented so please
use them with caution.- Added
Relay.Environment
.Relay.Store
is now simply a global instance of
RelayEnvironment
. To create your own isolated store and network subsystem,
create anew RelayEnvironment()
and make use of it whereverenvironment
is required. - Use
Relay.Environment#injectNetworkLayer
to inject a custom network layer
for use within the context of a particularRelay.Environment
instance. - Added
Relay.ReadyStateRenderer
. This component takes in an instance of
Relay.Environment
, aqueryConfig
that conforms to the
RelayQueryConfigInterface
, and a Relaycontainer
. It renders
synchronously based on the suppliedreadyState
. This primitive enables you
to create alternatives toRelay.Renderer
that fetch and handle data in a
custom way (eg. for server rendered applications). - Added
Relay.Renderer
– a replacement forRelay.RootContainer
that
composes aRelay.ReadyStateRenderer
and performs data fetching.
Relay.RootContainer
is now a wrapper aroundRelay.Renderer
that
substitutesRelay.Store
forenvironment
.
- Added
- Renamed the Flow type
RelayRendererRenderCallback
toRelayRenderCallback
. - Renamed the Flow type
RelayQueryConfigSpec
toRelayQueryConfigInterface
. RelayContainer.setVariables
will no longer check if the variables are
changed before re-running the variables. To prevent extra work, check the
current variables before callingsetVariables
.- You can now roll back mutations in the
COMMIT_QUEUED
state using
RelayMutationTransaction#rollback
. - When specifying a
NODE_DELETE
orRANGE_DELETE
mutation config, you can
omitparentID
if your parent, in fact, does not have an ID. - In cases where you query for a field, but that field is unset in the response,
Relay will now writenull
into the store for that field. This allows you to
return smaller payloads over the wire by simply omitting a key in the JSON
response, rather than to write an explicitfieldName: null
. - If the
relay
prop does not change between renders, we now recycle the same
object. This should enable you to make an efficientthis.props.relay === nextProps.relay
comparison inshouldComponentUpdate
. - You can now craft a connection query having invalid combinations of connection
arguments (first/last/after/before) so long as the values of those arguments
are variables and not concrete values (eg.friends(first: $first, last: $last)
will no longer cause the Relay Babel plugin to throw). - Added runtime validation to mutation configs to help developers to debug their
Relay.Mutation
. - Added
RelayNetworkDebug
. Invoke
require('RelayNetworkDebug').init(Relay.DefaultNetworkLayer)
to enjoy simple
to read logs of your network requests and responses on the console. Substitute
your own network layer if you use one. - Added two new
rangeBehaviors
:IGNORE
means the range should not be refetched at all.REFETCH
will refetch the entire connection.
- Connection diff optimization: Enables a mode where Relay skips diffing
information about edges that have already been fetched. This can be enabled by
adding@relay(variables: ['variableNames'])
to a connection fragment.
v0.7.3
- The instance of Babel that the babel-relay-plugin receives will now be used when making assertions about version numbers.
v0.7.2
- Identifying arguments on root fields can now be of any type - boolean, number, string, or array/object of the the same.
- Fixes a bug when we read connections or fragments without allocating a record until we encounter a child field that is not null. We now ensure that we allocate the record for connections and fragments (if it exists) regardless.
- Made babelAdapter compatible with Babel 6.6
npm run build
now works on Windows- Tests now pass when using Node 5 / NPM 3
- Passing an empty array as a prop corresponding to a plural fragment no longer warns about mock data. The empty array is now passed through to the component as-is.
- Removed
uri
fromRelayQueryConfigSpec
. Theuri
property was part ofRelayRoute
, but neverRelayQueryConfig
. This revision simply cleans up the Flow shape inRelayContainer
. - RelayRenderer now runs queries after mount to make sure
RelayRenderer
does not run queries during synchronous server-side rendering.
v0.7.1
v0.7.0
- Eliminated a race condition that would cause
RelayGarbageCollector
to fatal when, in the middle of areadRelayDiskCache
traversal, a container attempts to subscribe to a record not yet registered with the garbage collector. - The garbage collector now strictly increments references to all subscribed nodes, and strictly decrements references to all previously subscribed nodes, eliminating a class of race condition by ensuring an exact 1:1 correspondence of increment/decrement calls for a given node.
- Replaced
GraphQLStoreDataHandler
withRelayRecord
, and added theRelayRecord#isRecord
method. - Introduced
RelayQueryIndexPath
which tracks fragment indexes to the nearest parent field during query traversal. This replaces the existing logic used to generate field serialization keys. - Added
RelayContext
, a step toward making all Relay state contextual. - Improved query printing performance via short circuiting and inlining.
- Moved record writing functions out of
RelayRecordStore
and into a newRelayRecordWriter
class. - The Babel plugin now prints
canHaveSubselections
metadata on object-like fields that can contain child fields, making it possible to determine if a given field in a query is a true leaf node, or an object-type field having no subselections. This replacesRelayQueryNode#isScalar
withRelayQueryNode#canHaveSubselections
. RANGE_DELETE
mutation configs now allow you to specify an array path to a deleted node, rather than just adeletedIDFieldName
.- Renamed
Records
toRecordMap
. - Record reads from cache managers are now abortable. If the network request finishes before the cache read, for instance, the cache read can be cancelled.
- Added USERS.md; a catalog of products and developers that use Relay.
- You can now interpolate an array of fragments into a
Relay.QL
query. eg.${containers.map(c => c.getFragment('foo'))}
- Fixed a bug where invalid queries could be printed due to different variables having the same value; duplicates are now avoided.
v0.6.1
- Renamed
RelayStore#update
toRelayStore#commitUpdate
.RelayStore#commit
will be removed in v0.8.0. For an automated codemod that you can use to update your Relay app, visit https://github.com/relayjs/relay-codemod - Replaced
RelayTestUtils.unmockRelay();
withrequire('configureForRelayOSS');
in tests. - Fragment names in printed queries are now less verbose.
- Fixed a bug that caused queries to be printed incorrectly.
- Eliminated concrete fragment hashes.
- Connections now handle repeated edges more gracefully.
- Created a new
RelayTaskQueue
class. Used it to backRelayTaskScheduler
. - Reduced memory by only storing paths to container root nodes.
- Renamed
RelayTaskScheduler#await
toRelayTaskScheduler#enqueue
. - Fixed a series of memory leaks with a new GC implementation.
- Tests now run with Jasmine 2.
v0.6.0
- Bump the
babel-relay-plugin
version to v0.6.0 (now Babel 6 compatible). - The keys in
rangeBehaviors
are now compared against the sorted filter arguments of a field. For the fieldfoo(first: 10, b:true, a:false)
the matching range behavior key will be'a(false).b(true)'
. - Relay will now throw an invariant if range behavior keys are unsorted.
- Fragments are now supported in mutation fat queries.
- Added
Relay.Store#applyUpdate
method to create a transaction optimistically without committing it. Returns a transaction object that you can use tocommit()
orrollback()
. - Added
RelayStoreData#clearCacheManager
method. - Renamed
RelayQuery#getHash
toRelayQuery#getConcreteFragmentHash
- Removed
RelayQueryPath#toJSON
andRelayQueryPath#fromJSON
v0.5.0
- Bump the
babel-relay-plugin
version to v0.4.1.- Added validation of arguments for connections with
edges
orpageInfo
.- Connections without arguments in fat queries can add the new fragment directive
@relay(pattern: true)
.
- Connections without arguments in fat queries can add the new fragment directive
- Fixed validation of fields within inline fragments in connections.
- Print queries using a plain-object representation (instead of
GraphQL
objects).
- Added validation of arguments for connections with
RelayQueryField#getStorageKey
will now produce the same key regardless of the order of a field's arguments.- Range behavior keys in mutation configs are now guaranteed to be sorted.
- Added the
Relay.createQuery()
function which returns aRelayQuery.Root
(that can be used withRelay.Store
methods). - Optimistic response keys now use GraphQL OSS syntax. (Usage of old, call-like syntax is now deprecated and will warn.)
- Fix a bug where optimistic queries could cause the error "Could not find a type name for record ...".
v0.4.0
- Bump the
babel-relay-plugin
version to v0.3.0.- Fixed the metadata for fields on abstract types.
- Directives are now validated against the schema.
- Mutations field arguments are now validated.
- Non-root
node(id: ...)
fields are now invalid. - Added support for
RelayQL
template tag. - Improvements to validation and error messages.
- The
__typename
of abstract types are now fetched and stored locally. - Fixed
hasOptimisticUpdate
returning true after mutation succeeds (#86). - Fixed printing mutations with generated
id
fields (#414). - Fixed updating views when removing the last element in a plural field (#401).
- Fixed sending mutations via classes without invalid GraphQL characters (#448).
- Added a
__DEV__
-only warning when data is passed down via the wrong prop.