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.
- ...
- Fixed breaking change: readQueryFromStore was incomptibale with Typescript 2.0 compiler. PR #1171
Re-release of 0.7.1 with proper internal directory structure
- Undo breaking change: Add whatwg-fetch polyfill (most likely only until version 1.0) PR #1155
- Deprecate "resultTransformer" PR #1095
- Deep freeze results in development and test mode PR #1095
- Breaking: Use generic types for query and mutation PR #914
- Support AMD PR #1069
- Support ES6 Modules and tree-shaking (
module
,jsnext:main
) PR #1069 - Breaking: Replace
@types/redux
with official typescript definitions PR #1069 - Breaking: Remove fragment option from query, watchQuery etc. PR #1096
- Broadcast new store state only when Apollo state was affected by an action PR #1118
- Remove lodash as a production dependency PR #1122
- Breaking: Minor fix to write to
ROOT_SUBSCRIPTION
ID in the store for subscription results. PR #1122 - Breaking: Remove
whatwg-fetch
polyfill dependency and instead warn when a globalfetch
implementation is not found. PR #1134 - Child objects returned from
watchQuery
may now be referentially equal (soa === b
) to previous objects in the same position if nothing changed in the store. This allows for a better UI integration experience when determining what needs to rerender. PR #1136
- Add variables to MutationResultAction PR #1106
- Fix incorrect network status after first refetch PR #1105
- Pass variables into result reducers PR #1088
- Add option to deduplicate in-flight queries PR #1070
- Revert back to using
whatwg-fetch
becauseisomorphic-fetch
does not work in react native PR #1058
- Fix bug that caused updateQuery and reducers to run on stopped queries PR #1054
- Ensure transporters are using
isomorphic-fetch
instead ofwhatwg-fetch
for universal compatibility PR #1018
- Include a
version
field on everyApolloClient
instance that represents the version of the 'apollo-client' package used to create it. PR #1038
- Attach to
window
for devtools if not in production, so that improperly configured environments do get the dev tools. PR #1037
- Make sure stopped queries are not refetched on store reset PR #960
- Make sure
APOLLO_QUERY_RESULT_CLIENT
action has arequestId
, just likeAPOLLO_QUERY_RESULT
does, so that it can be associated with the relevantAPOLLO_QUERY_INIT
action.
- For devtools hook, report the state after the action, not before. PR #1023
- Make sure Redux devtools enhancer is added last. PR #1022
- Make sure devtools hook added in 0.5.14 also works when the store is initialized by Apollo Client. PR #1021
- Add internal hook for chrome devtools,
__actionHookForDevTools
, to get a log of actions and states. Apollo Client automatically attaches itself towindow.__APOLLO_CLIENT__
when initialized ifprocess.env.NODE_ENV === 'development'
. This can be forced or disabled by setting theconnectToDevTools
option in the constructor totrue
orfalse
. PR #1017
- Replace usages of
Object.assign
with lodash's assign function PR #1009 - Calls to watchQuery can include metadata, for use with debugging. PR #1010
- Errors thrown in afterwares bubble up PR #982
- Replaced individual lodash packages with original lodash package PR #997
- Move typed-graphql and chai typings to optionalDependencies PR #988
- Fix issue with typings that prevented compilation in typescript PR #986
- Deprecate usage of fragment option and createFragment function PR #984
- Prevent Redux from crashing when an uncaught ApolloError is raised in an Apollo reducer. PR #874
- Catch errors in observer.next and observer.errors callback PR #980
- Added
HTTPFetchNetworkInterface
andNetworkInterface
as index exports to make them easier to subclass externally. #969
- Catch uncaught promise errors in startQuery #950
- Refactor polling query logic to fix startPolling and stopPolling #938
- Add convenience method to obtain initial state from SSR #941
- Add back missing dependency on lodash.isequal that was mistakenly removed in 0.5.4 #925
- Implement cache redirects with custom resolvers PR #921
- Fix issue that caused
createBatchingNetworkInterface
unable to specify request headers byopts
orapplyMiddleware
. PR #922 Issue #920
- Fix a bug that caused apollo-client to catch errors thrown in Observer.next callbacks PR #910
- Make sure only one copy of each fragment is attached to a document PR #906
- Change the way IDs of objects in arrays are stored to make them consistent with the rest of the store PR #901
- Print a warning if server response is not an array when using transport batching PR #893
- apply addTypename in watchQuery for result reducers PR #895
- new Feature: Enable chaining of
use
anduseAfter
function calls in network interface. PR #860 Issue #564 - Create and expose the
MutationOptions
PR #866 - Expose
SubscriptionOptions
PR #868 - Fix issue with
currentResult
and optimistic responses Issue #877 - Provide an onError callback for subscribeToMore PR #886
- Bind
resetStore
to ApolloClient PR #882 - Fix a bug with
resetStore
that caused existing queries to fail PR #885
- Add a
createdBatchingNetworkInterface
function and export it. - Add support for fragments to
fetchMore
- Patch for race condition in broadcastQueries that occasionally crashed the client.
- new Feature: add networkStatus to ApolloResult, which gives more fine-grained information than the loading boolean. Added notifyOnNetworkStatusChange option to WatchQuery options. PR #827
- Fix a bug with result reducers that caused crashed when queries were updated in loading state.
- Make
createNetworkInterface
backwards compatible, but print a deprecation warning if it's called with two arguments. The new way is to pass in an object withuri
andopts
properties. PR #828 Issue #806 - Prevent store rehydration if queries and mutations are not empty. PR #814
- Fix an issue with
observableQuery.currentResult()
when the query had returned an error.
- new Feature: Add fetchMore-style subscribeToMore function which updates a query result based on a subscription. PR #797
- Fix accidental breaking change in updateQueries that was introduced in 0.5.0-0 PR 801
- new Feature: Implement query reducers, which run on every query result/ mutation. PR #766
- Refactor: Reimplement internal store reading in terms of the graphql-anywhere package, which cleanly separates the GraphQL execution logic from Apollo's specific cache format. This will allow us to make the store reading much more extensible, including enabling developers to write their own custom client-side resolvers to implement client-side computed fields, read from Redux with GraphQL, and redirect cache reads.
- Feature removal: Remove query diffing functionality to make client more predictable and simplify implementation. Queries will still read from the store, and if the store does not have all of the necessary data the entire query will fetch from the server. Read justification and discussion in Issue #615 PR #693
- Breaking change: Move batching to network interface and split off query merging into separate package PR #734
- Feature removal: No more
(read|diff)(Fragment|SelectionSet)FromStore
. - Feature removal: No more
write(Fragment|SelectionSet)ToStore
. - Fix: refetch only updates original query variable options
- Fix: Moved @types packages from devDependencies to dependencies as discussed in Issue #713
- Refactor: Rewrite how fragments are handled. Remove all validation of fragments when writing to the store, assuming that a spec-compliant server will return a valid set of fragments and results. On reading from the store, use
__typename
if it exists, and strongly encourage using theaddTypename: true
option by warning when the__typename
field is not in the query and result. Issue #739 PR #767 - GraphQL subscriptions fire an action when new data arrives PR #775
- Feature removal and addition: The
ApolloClient
constructor no longer accepts aqueryTransformer
option. Instead, there is a a newaddTypename
option which is on by default. Issue #616 PR #779 - Refactor: removed circular dependency in data/store.ts Issue #731 PR #778
- added "ApolloClient" to the named exports to make it compatible with Angular2 AOT compile Issue #758 PR #778
- Fix: moved dev @types to devDependencies otherwise they potentially brake projects that are importing apollo-client Issue #713 PR #778
- Fix rejecting promises on
refetch
and similar methods. Also improve error handling and stop usingApolloError
internally. Failing test in PR #524 PR #781 - Fix multidimentional array handling. Issue #776 PR #785
- Add support for Enum inline arguments Issue #183 PR #788
- Make it possible to subscribe to the same observable query multiple times. The query is initialized on the first subscription, and torn down after the last. Now, QueryManager is only aware of one subscription from the ObservableQuery, no matter how many were actually registered. This fixes issues with
result()
and other ObservableQuery features that relied on subscribing multiple times to work. This should remove the need for the workaround in0.4.21
. Repro in PR #694 PR #791
- Added some temporary functions (
_setVariablesNoResult
and_setOptionsNoResult
) to work around areact-apollo
problem fundamentally caused by the issue highlighted in PR #694. The code as been refactored onmaster
, so we expect it to be fixed in 0.5.x, and is not worth resolving now.
- Fix: Warn but do not fail when refetchQueries includes an unknown query name PR #700
- Fix: avoid field error on mutations after a query cancellation or a query failure by enforcing returnPartialData during previous data retrieval before applying a mutation update. PR #696 and Issue #647.
- Add observableQuery.setVariables function PR #635
- Add observableQuery.currentResult function PR #697
- Update to typescript 2.0.3 PR #697
- Fix: set default reduxRootKey for backwards-compatibility when using ApolloClient as middleware PR #688
- Fix bug with null fragments introduced in 0.4.16 PR #683
- Set reduxRootKey for backwards-compatibility, even when using reduxRootSelector PR #685
- This version is identical to 0.4.15. It was published over 0.4.16 because that had some unintentional breaking changes. Once the breaks are identified and fixed, there will be a 0.4.18 with the new features.
- Backwards compatible deprecation Add a
reduxRootSelector
option and deprecatereduxRootKey
. This will allow people to put Apollo anywhere they like, even inside a store otherwise managed by ImmutableJS. Note: if you pass areduxRootKey
in this version, it will automatically create areduxRootSelector
for you, and attach it to theApolloClient
instance as before, but this behavior will be removed in0.5
. PR #631 - Make sure stopping a poll interval doesn't stop updates from the store. PR #625
- Include more type definitions and methods in root export for use in react-apollo PR #619
- Added
resultTransformer
andresultComparator
toApolloClient
/QueryManager
, which afford the ability to transform result objects immediately before they are returned to the application. PR #446 - Fixed issue with nested fragments overriding each other. PR #629
- Options set in middleware can override the fetch query in the network layer. Issue #627 and PR #628.
- Make
returnPartialData
work better with fragments. PR #580
- Avoid extra
assign
when there are no optimistic updates present. [PR #597]((apollographql#597) - Fixed issue with error passing with query merging. PR #589 and Issue #551.
- Allow network interface middlewares to change the
req.request
object to add additional fields to the request body. PR #548 and Issue #547. - Fixed an issue with batching and variables used in directives. PR #584 and Issue #577.
- Implemented transport-level batching the way it is currently supported within Apollo Server. PR #531 and Issue #505.
- [Experimental] Change subscription API to
subscribe
function on Apollo Client instance, and removefetchMore
-style API temporarily.
- Fix issue where starting, stopping, then starting a polling query with the same interval wasn't handled correctly by the scheduler. Opened as PR #555 and merged via PR #568.
- Fixed an issue with used variables in directives related to unused variables stripping PR #563 and Issue #562
- Change subscription API to use
updateQuery
, likefetchMore
does, instead ofupdateFunction
. PR #574
- Fixed an issue with named fragments in batched queries. PR #509 and Issue #501.
- Fixed an issue with unused variables in queries after diffing queries against information available in the store. PR #518 and Issue #496.
- Add code to support GraphQL subscriptions. PR #540.
- Fixed a couple of issues within query merging that caused issues with null values or arrays in responses. PR #523.
- Added an
updateQuery
method on observable queries. Allows application code to arbitrary change the result of a query normalized to store, without issuing any network requests. PR #506 and Issue #495. - Fixed issue where result of fetchMore from server wasn't being passed through PR #508
- Added an
refetchQueries
option tomutate
. The point is to just refetch certain queries on a mutation rather than having to manually specify how the result should be incorporated for each of them withupdateQueries
. PR #482 and Issue #448. - Print errors produced by application-supplied reducer functions passed to
updateQueries
orupdateQuery
options formutate
orfetchMore
respectively. PR #500 and Issue #479.
-
Fixed issue with alias names in batched queries. PR #493 and Issue #490.
-
Add loading state tracking within Apollo Client in order to simplify the handling of loading state within the view layers. Issue #342 and PR #467
-
Fixed the way new variables extend the original arguments when passed to methods
fetchMore
andrefetch
. PR #497.
- Fixed issue with
fragments
array forupdateQueries
. PR #475 and Issue #470. - Add a new experimental feature to observable queries called
fetchMore
. It allows application developers to update the results of a query in the store by issuing new queries. We are currently testing this feature internally and we will document it once it is stable. PR #472.
- Add
useAfter
function that acceptsafterwares
. Afterwares run after a request is made (after middlewares). In the afterware function, you get the whole response and request options, so you can handle status codes and errors if you need to. For example, if your requests return a401
in the case of user logout, you can use this to identify when that starts happening. It can be used just as amiddleware
is used. Just pass an array of afterwares to theuseAfter
function. - Fix issues with union type handling for inline and named fragments. PR #356, Issue #354 Issue #355.
- Add a stack trace to
ApolloError
. PR #445 and Issue #434. - Fixed an extra log of errors on
query
calls. PR #445 and Issue #423. - Fix repeat calls to a query that includes fragments PR #447.
- GraphQL errors on mutation results now result in a rejected promise and are no longer a part of returned results. PR #465 and Issue #458.
- Don't add fields to root mutations and root queries PR #463 and Issue #413.
- Added flattening of fragments within
createFragment
. PR #437 and Issue #421.
- Integrated the scheduler so that polling queries on the same polling interval are batched together. PR #403 and Issue #401.
- Fixed a bug where fetching a query without an id and then later with an id resulted in an orphaned node within the store. Issue #344 and PR #389.
- Fix typings for some refactored types,
ObservableQuery
andWatchQueryOptions
. PR #428
- Fix the issue of using query transformers with mutations containing
optimisticResponse
orupdateQueries
. PR #426.
- Make sure query transformers are also applied to named fragments, and new methods that allow transforming query document with multiple query transformers. Issue #373 PR #412
- Introduce a new (preferable) way to express how the mutation result should be incorporated into the store and update watched queries results:
updateQueries
. PR #404. - Writing query results to store no longer creates new objects (and new references) in cases when the new value is identical to the old value in the store.
- 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 deep result comparison so that observers are only fired when the data associated with a particular query changes. This change eliminates unnecessary re-renders and improves UI performance. PR #402 and Issue #400.
- Added a "noFetch" option to WatchQueryOptions that only returns available data from the local store (even it is incomplete). The
ObservableQuery
returned from callingwatchQuery
now hasoptions
,queryManager
, andqueryId
. ThequeryId
can be used to read directly from the state ofapollo.queries
. Issue #225, Issue #342, 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.