Expect active development and potentially significant breaking changes in the 0.x
track. We'll try to be diligent about releasing a 1.0
version in a timely fashion (ideally within 3 to 6 months), to signal the start of a more stable API.
-
Added the
batchInterval
option to ApolloClient that allows you to specify the width of the batching interval as per your app's needs. Issue #394 and PR #395. -
Stringify
storeObj
for error message indiffFieldAgainstStore
. -
Fix map function returning
undefined
inremoveRefsFromStoreObj
. PR #393 -
Added a "noFetch" option to WatchQueryOptions that only returns available data from the local store (even it is incomplete). Issue #225 and PR #385.
- Allow
client.mutate
to accept anoptimisticResponse
argument to update the cache immediately, then after the server responds replace theoptimisticResponse
with the real response. Issue #287 PR #336
This release has a minor version bump, which means npm will not automatically update to this version. Consider the list of breaking changes below, then upgrade and update your app correspondingly.
-
Breaking change Remove backcompat shim for
import ... from 'apollo-client/gql'
. Instead, use thegraphql-tag
package as recommended in the docs and official examples. Issue #324 PR #387 -
Breaking change Moved refetch(), startPolling(), and stopPolling() methods from QuerySubscription to ObservableQuery. This shouldn't affect anyone using
react-apollo
, but if you were calling those methods on the subscription directly, you need to call them on the query handle/observable instead. The benefit of this is that developers that want to use RxJS for their observable handling can now have access to these methods. [Issue #194] (apollographql#194) and [PR #362] (apollographql#362) -
Breaking change Unified error handling for GraphQL errors and network errors. Both now result in rejected promises and passed as errors on observables through a new
ApolloError
type. This is a significant departure from the previous method of error handling which passed GraphQL errors in resolvers andnext
methods on subscriptions. PR #352
- Don't throw on unknown directives, instead just pass them through. This can open the door to implementing
@live
,@defer
, and@stream
, if coupled with some changes in the network layer. PR #372
- Made sure that query merging is only applied when we have more than one query in the batcher's queue Issue #308 and PR #369.
- Added missing export for the
addQueryMerging
method defined in the docs here. PR #364 and Issue #363. - Made sure
diffSelectionSetAgainstStore
will return any available data from the local cache ifthrowOnMissingField
isfalse
, even if some fields in the query are missing. This also means that thereturnPartialData
option ofwatchQuery
will return partial data if some fields are missing in the cache, rather than an empty object. Issue #359 and PR #360.
- Removed dependency on
graphql
npm package, which was causing compilation errors in the React Native bundler. Issues #261 #163, PR #357 - Added support for query composition through fragments Issue #338 and PR #343
- Exposed a
printAST
method that is justgraphql-js
'sprint
method underneath PR #337. With PR #277, we moved to using the query AST as the representation of the query passed to the network interface. Unfortunately, this broke implementations of network interfaces. By exposingprintAST
, custom network interface implementations will be able to convert the query AST to a string easily.
- Fix regression where options passed to query and watchQuery were modified if
shouldForceFetch
was false. Issue #339 PR #340 - Add flexible mutation result handling to Apollo Client.
- This is done by passing an
resultBehaviors
option toclient.mutate
, with an array of "Mutation Result Behaviors". - You can attach any number of result behaviors to each mutation.
- These result behaviors are attached to the
MUTATION_RESULT
redux action that is dispatched when the query result arrives from the store, and are handled by special "Mutation Behavior Reducers". These are similar to regular Redux reducers, but they get a whole bunch of GraphQL-specific information in the arguments, and are all called synchronously in order when the result of a mutation arrives. - In this version, Apollo Client ships with a set of default mutation result behaviors/reducers including
ARRAY_INSERT
,DELETE
, andARRAY_DELETE
, but you can add any custom ones you want by passing the newmutationBehaviorReducers
option to theApolloClient
constructor. - The previous default functionality of merging all mutation results into the store is preserved.
- Added
client.dataId
andclient.fieldWithArgs
helpers to generate store paths for mutation behaviors. - PR #320 Read the design in depth in Issue #317
- This is done by passing an
- Added support for resetting the store Issue #158 and PR #314.
- Deprecate
apollo-client/gql
forgraphql-tag
and show a meaningful warning when importingapollo-client/gql
- Fix unintentional breaking change where
apollo-client/gql
import stopped working. Issue #327
- Move out GraphQL query parsing into a new package
graphql-tag
with a backcompat shim forapollo-client/gql
. Issue #312 PR #313 - Added
ssrMode
(to disableforceFetch
queries completely) andssrForceFetchDelay
(to disable it for a short time period). This is for server-side rendering -- on the server it doesn't make sense to force fetch (you just want a single snapshot of data, not changing data), and when you first re-render on the client, the server's data is up to date, so there's no need to re-fetch. Issue #298 PR #309 addTypename
query transform now doesn't add extra__typename
fields where they are already present. PR #323
- Exported
writeQueryToStore
andwriteFragmentToStore
directly fromapollo-client
to matchreadQueryFromStore
andreadFragmentFromStore
. PR #311 - Add (optional)
returnPartialData
toreadFragmentFromStore
andreadQueryFromStore
. PR #310
- Exported
addTypename
query transform directly fromapollo-client
so that it doesn't need to be imported from a submodule. PR #303 - Made network interfaces from
createNetworkInterface
have batching capability by default. PR #303
- Solved an issue that occurred when merging two queries with exactly the same query document Issue #296 and PR #299
- Add
shouldBatch
option toApolloClient
constructor, default tofalse
for now. PR #294
- Implemented query merging and batching support Issue #164, PR #278 and PR #277
- Added support for
@skip
and@include
directives - see Issue #237 and PR #275
- Added support for inline object and array arguments in queries and mutations, where previously you had to use variables. PR #252
- Added name fragment support within mutations Issue #273 and PR #274
- Now sending the operation name along with the query to the server Issue #259 and PR #282
- Removed AuthTokenHeaderMiddleware code and related tests from apollo-client Issue #247
- Added named fragment support Issue #80 and PR #251.
- Added basic guards to our Redux Store
subscribe
to preventbroadcastQueries
from being called unnecessarily - Fixed polling leak issue that occured with multiple polling queries (apollographql#248)
- add whatwg-fetch to fix promise problems with fetch (catch error '{}') that occurs in special browser/older browser (eg. Wechat browser in China )PR #256.
- updated graphql dependency to include ^0.6.0
- Fix query transformation for queries called with
forceFetch
. PR #240
- Add support for basic query transformation before submitting to the server by passing an option to
ApolloClient
constructor. (e.g. adding__typename
to each SelectionSet) Issue #230 PR #233
- Resolve a race condition between
QueryManager
stopQuery()
andbroadcastQueries()
, which would result in an errorlistener is not a function
. Issue #231 PR #232
- Namespace Apollo action types to prevent collision with user's own Redux action types. Issue #210 PR #222
- Queries on refetch return promises. PR #178
- Add support for GraphQLJSON scalar type by changing the way we identify scalar types when writing to the store. Issue #217 PR #219
- Add
dataIdFromObject
option toApolloClient
constructor, to allow data normalization. This function should take a GraphQL result object, and return an ID if one can be found. Issue #204 PR #214
- Use
console.error
to log unhandled network errors. Issue #189 PR #203 - Suggest using variables instead of inline arguments for non-scalar types. Issue #202 PR #211
- Improve error message when a dev forgets
gql
to link to docs. PR #181 - Memoize results from
gql
, so that we save time on parsing, and we can use===
to compare queries for performance. Issue #199 PR #200 - Fix error when using
returnPartialData
. Issue #193 PR #201 - Add basic interoperability with other Observable implementations like RxJS. Issue #149 PR #196
- Fix improperly published package that broke submodule paths. Issue #186
- Fix regression from 0.3.2 that broke root query diffing
- Enhance query printer so that it can print multiple root queries Issue #184 react-apollo issue #45 PR #185
- Added support for inline fragments. Issue #147 PR #175
- Removed vestigial code that partially implemented refetching via the Relay Node interface, but was not possible to use through the public API.
- Made client more robust in the case where the server returns an empty error array, even though that's not in the GraphQL spec. Issue #156 PR #173
- Breaking change: Require all queries to be wrapped with a
gql
template literal tag, and throw an error when they aren't. Issue #155 PR #168 - Remove all dependencies on the
graphql
parser module at runtime, except for thegql
template literal tag, so that queries can be pre-parsed in production to save on parsing overhead. - Add everything that isn't a compiled file to
npmignore
. PR #165 - Move importable modules to root. PR #169
- Add polling functionality to
watchQuery
. Issue #145 PR #153
Initial release. We didn't track changes before this version.