Releases: apollographql/apollo-client
3.1.0
Apollo Client 3.1.0
Bug Fixes
-
Rework interdependencies between
@apollo/client/*
entry points, so that CommonJS and ESM modules are supported equally well, without any duplication of shared code.
@benjamn in #6656 and #6657 -
Tolerate
!==
callback functions (likeonCompleted
andonError
) inuseQuery
options, since those functions are almost always freshly evaluated each timeuseQuery
is called.
@hwillson and @benjamn in #6588 -
Respect
context.queryDeduplication
if provided, and otherwise fall back toclient.deduplication
(as before).
@igaloly in #6261 and @Kujawadl in #6526 -
Refactor
ObservableQuery#getCurrentResult
to reenable immediate delivery of warm cache results. As part of this refactoring, theApolloCurrentQueryResult
type was eliminated in favor ofApolloQueryResult
.
@benjamn in #6710 -
Avoid clobbering
defaultOptions
withundefined
values.
@benjamn in #6715
Improvements
-
Apollo Client will no longer modify
options.fetchPolicy
unless you passoptions.nextFetchPolicy
to request an explicit change inFetchPolicy
after the current request. Although this is technically a breaking change,options.nextFieldPolicy
makes it easy to restore the old behavior (by passingcache-first
).
@benjamn in #6712, reverting #6353 -
Errors of the form
Invariant Violation: 42
thrown in production can now be looked up much more easily, by consulting the auto-generated@apollo/client/invariantErrorCodes.js
file specific to your@apollo/client
version.
@benjamn in #6665 -
Make the
client
field of theMutationResult
type non-optional, since it is always provided.
@glasser in #6617 -
Allow passing an asynchronous
options.renderFunction
togetMarkupFromTree
.
@richardscarrott in #6576 -
Ergonomic improvements for
merge
andkeyArgs
functions in cache field policies.
@benjamn in #6714
Apollo Client 3.0.2
Bug Fixes
- Avoid duplicating
graphql/execution/execute
dependency in CommonJS bundle for@apollo/client/link/schema
, fixinginstanceof
errors reported in #6621 and #6614.
@benjamn in #6624
Apollo Client 3.0.1
Bug Fixes
3.0.0
Apollo Client 3.0.0
Improvements
⚠️ Note: As of 3.0.0, Apollo Client uses a new package name:@apollo/client
ApolloClient
-
[BREAKING]
ApolloClient
is now only available as a named export. The defaultApolloClient
export has been removed.
@hwillson in #5425 -
[BREAKING] The
queryManager
property ofApolloClient
instances is now marked asprivate
, paving the way for a more aggressive redesign of its API. -
[BREAKING] Apollo Client will no longer deliver "stale" results to
ObservableQuery
consumers, but will instead log more helpful errors about which cache fields were missing.
@benjamn in #6058 -
[BREAKING]
ApolloError
's thrown by Apollo Client no longer prefix error messages withGraphQL error:
orNetwork error:
. To differentiate between GraphQL/network errors, refer toApolloError
's publicgraphQLErrors
andnetworkError
properties.
@lorensr in #3892 -
[BREAKING] Support for the
@live
directive has been removed, but might be restored in the future if a more thorough implementation is proposed.
@benjamn in #6221 -
[BREAKING] Apollo Client 2.x allowed
@client
fields to be passed into thelink
chain ifresolvers
were not set in the constructor. This allowed@client
fields to be passed into Links likeapollo-link-state
. Apollo Client 3 enforces that@client
fields are local only, meaning they are no longer passed into thelink
chain, under any circumstances.
@hwillson in #5982 -
[BREAKING?] Refactor
QueryManager
to make better use of observables and enforcefetchPolicy
more reliably.
@benjamn in #6221 -
The
updateQuery
function previously required byfetchMore
has been deprecated with a warning, and will be removed in the next major version of Apollo Client. Please consider using amerge
function to handle incoming data instead of relying onupdateQuery
.
@benjamn in #6464 -
Helper functions for generating common pagination-related field policies may be imported from
@apollo/client/utilities
. The most basic helper isconcatPagination
, which emulates the concatenation behavior of typicalupdateQuery
functions. A more sophisticated helper isoffsetLimitPagination
, which implements offset/limit-based pagination. If you are consuming paginated data from a Relay-friendly API, userelayStylePagination
. Feel free to use these helper functions as inspiration for your own field policies, and/or modify them to suit your needs.
@benjamn in #6465 -
Updated to work with
graphql@15
.
@durchanek in #6194 and #6279
@hagmic in #6328 -
Apollo Link core and HTTP related functionality has been merged into
@apollo/client
. Functionality that was previously available through theapollo-link
,apollo-link-http-common
andapollo-link-http
packages is now directly available from@apollo/client
(e.g.import { HttpLink } from '@apollo/client'
). TheApolloClient
constructor has also been updated to accept newuri
,headers
andcredentials
options. Ifuri
is specified, Apollo Client will take care of creating the necessaryHttpLink
behind the scenes.
@hwillson in #5412 -
The
gql
template tag should now be imported from the@apollo/client
package, rather than thegraphql-tag
package. Although thegraphql-tag
package still works for now, future versions of@apollo/client
may change the implementation details ofgql
without a major version bump.
@hwillson in #5451 -
@apollo/client/core
can be used to import the Apollo Client core, which includes everything the main@apollo/client
package does, except for all React related functionality.
@kamilkisiela in #5541 -
Several deprecated methods have been fully removed:
ApolloClient#initQueryManager
QueryManager#startQuery
ObservableQuery#currentResult
-
Apollo Client now supports setting a new
ApolloLink
(or link chain) afternew ApolloClient()
has been called, using theApolloClient#setLink
method.
@hwillson in #6193 -
The final time a mutation
update
function is called, it can no longer accidentally read optimistic data from other concurrent mutations, which ensures the use of optimistic updates has no lasting impact on the state of the cache after mutations have finished.
@benjamn in #6551 -
Apollo links that were previously maintained in https://github.com/apollographql/apollo-link have been merged into the Apollo Client project. They should be accessed using the new entry points listed in the migration guide.
@hwillson in #
InMemoryCache
⚠️ Note:InMemoryCache
has been significantly redesigned and rewritten in Apollo Client 3.0. Please consult the migration guide and read the new documentation to understand everything that has been improved.
-
The
InMemoryCache
constructor should now be imported directly from@apollo/client
, rather than from a separate package. Theapollo-cache-inmemory
package is no longer supported.The
@apollo/client/cache
entry point can be used to importInMemoryCache
without importing other parts of the Apollo Client codebase.
@hwillson in #5577 -
[BREAKING]
FragmentMatcher
,HeuristicFragmentMatcher
, andIntrospectionFragmentMatcher
have all been removed. We now recommend usingInMemoryCache
’spossibleTypes
option instead. For more information see the DefiningpossibleTypes
manually section of the docs.
@benjamn in #5073 -
[BREAKING] As promised in the Apollo Client 2.6 blog post, all cache results are now frozen/immutable.
@benjamn in #5153 -
[BREAKING] Eliminate "generated" cache IDs to avoid normalizing objects with no meaningful ID, significantly reducing cache memory usage. This might be a backwards-incompatible change if your code depends on the precise internal representation of normalized data in the cache.
@benjamn in #5146 -
[BREAKING]
InMemoryCache
will no longer merge the fields of written objects unless the objects are known to have the same identity, and the values of fields with the same name will not be recursively merged unless a custommerge
function is defined by a field policy for that field, within a type policy associated with the__typename
of the parent object.
@benjamn in #5603 -
[BREAKING]
InMemoryCache
now throws when data with missing or undefined query fields is written into the cache, rather than just warning in development.
@benjamn in #6055 -
[BREAKING]
client|cache.writeData
have been fully removed.writeData
usage is one of the easiest ways to turn faulty assumptions about how the cache represents data internally, into cache inconsistency and corruption.client|cache.writeQuery
,client|cache.writeFragment
, and/orcache.modify
can be used to update the cache.
@benjamn in #5923 -
InMemoryCache
now supports tracing garbage collection and eviction. Note that the signature of theevict
method has been simplified in a potentially backwards-incompatible way.
@benjamn in #5310 -
[beta-BREAKING] Please note that the
cache.evict
method now requiresCache.EvictOptions
, though it pr...
v3.0.0-rc.0
Now that the release candidate phase of testing has begun, we will do our very best to avoid introducing any new features or breaking API changes, unless those changes are absolutely necessary to fix bugs.
We are very much aware of a number of outstanding bugs, and we fully intend to fix all known bugs before the final AC3 release, in addition to continuing to write and edit the documentation for new AC3 features: https://github.com/apollographql/apollo-client/milestone/14
If you have been waiting for a signal that the AC3 API is stable/frozen, this is it. However, if you are not interested in helping to identify and fix (or at least work around) the remaining issues, then you should wait for the final release before updating.
Changes: https://github.com/apollographql/apollo-client/blob/v3.0.0-rc.0/CHANGELOG.md
2.6.8
Apollo Client 2.6.8
Apollo Client (2.6.8)
-
Update the
fetchMore
type signature to acceptcontext
.
@koenpunt in #5147 -
Fix type for
Resolver
and use it in the definition ofResolvers
.
@peoplenarthax in #4943 -
Local state resolver functions now receive a
fragmentMap: FragmentMap
object, in addition to thefield: FieldNode
object, via theinfo
parameter.
@mjlyons in #5388 -
Documentation updates.
@tomquirk in #5645
@Sequoia in #5641
@phryneas in #5628
@AryanJ-NYC in #5560
GraphQL Anywhere (4.2.6)
- Fix
filter
edge case involvingnull
.
@lifeiscontent in #5110
Apollo Boost (0.4.7)
-
Replace
GlobalFetch
reference withWindowOrWorkerGlobalScope
.
@abdonrd in #5373 -
Add
assumeImmutableResults
typing to apollo boostPresetConfig
interface.
@bencoullie in #5571