Releases: apollographql/apollo-client
3.2.0
Apollo Client 3.2.0
Bug Fixes
-
Use
options.nextFetchPolicyinternally to restore originalFetchPolicyafter polling withfetchPolicy: "network-only", so that polling does not interfere with normal query watching.
@benjamn in #6893 -
Initialize
ObservableQueryinupdateObservableQueryeven ifskipistrue.
@mu29 in #6999 -
Prevent full reobservation of queries affected by optimistic mutation updates, while still delivering results from the cache.
@benjamn in #6854
Improvements
-
In TypeScript, all APIs that take
DocumentNodeparameters now may alternatively takeTypeDocumentNode<Data, Variables>. This type has the same JavaScript representation but allows the APIs to infer the data and variable types instead of requiring you to specify types explicitly at the call site.
@dotansimha in #6720 -
Bring back an improved form of heuristic fragment matching, by allowing
possibleTypesto specify subtype regular expression strings, which count as matches if the written result object has all the fields expected for the fragment.
@benjamn in #6901 -
Allow
options.nextFetchPolicyto be a function that takes the currentFetchPolicyand returns a new (or the same)FetchPolicy, makingnextFetchPolicymore suitable for global use indefaultOptions.watchQuery.
@benjamn in #6893 -
Implement
useReactiveVarhook for consuming reactive variables in React components.
@benjamn in #6867 -
Move
apollo-link-persisted-queriesimplementation to@apollo/client/link/persisted-queries. Try running our automated imports transform to handle this conversion, if you're usingapollo-link-persisted-queries.
@hwillson in #6837 -
Disable feud-stopping logic after any
cache.evictorcache.modifyoperation.
@benjamn in
#6817 and
#6898 -
Throw if
writeFragmentcannot identifyoptions.datawhen nooptions.idprovided.
@jcreighton in #6859 -
Provide
options.storageobject tocache.modifyfunctions, as provided toreadandmergefunctions.
@benjamn in #6991 -
Allow
cache.modifyfunctions to returndetails.INVALIDATE(similar todetails.DELETE) to invalidate the current field, causing affected queries to rerun, even if the field's value is unchanged.
@benjamn in #6991 -
Support non-default
ErrorPolicyvalues (that is,"ignore"and"all", in addition to the default value"none") for mutations and subscriptions, like we do for queries.
@benjamn in #7003 -
Remove invariant forbidding a
FetchPolicyofcache-onlyinObservableQuery#refetch.
@benjamn in ccb0a79a, fixing #6702
Apollo Client 3.1.5
Bug Fixes
Improvements
Apollo Client 3.1.4
Bug Fixes
-
Restrict root object identification to
ROOT_QUERY(the ID corresponding to the rootQueryobject), allowingMutationandSubscriptionas user-defined types.
@benjamn in #6914 -
Prevent crash when
pageInfoand emptyedgesare received byrelayStylePagination.
@fracmak in #6918
Apollo Client 3.1.3
Bug Fixes
- Consider only
result.data(rather than all properties ofresult) when settling cache feuds.
@danReynolds in #6777
Improvements
- Provide jscodeshift transform for automatically converting Apollo Client 2.x
importdeclarations to use Apollo Client 3.x packages. Instructions.
@dminkovsky and @jcreighton in #6486
Apollo Client 3.1.2
Bug Fixes
Improvements
Apollo Client 3.1.1
Bug Fixes
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 (likeonCompletedandonError) inuseQueryoptions, since those functions are almost always freshly evaluated each timeuseQueryis called.
@hwillson and @benjamn in #6588 -
Respect
context.queryDeduplicationif provided, and otherwise fall back toclient.deduplication(as before).
@igaloly in #6261 and @Kujawadl in #6526 -
Refactor
ObservableQuery#getCurrentResultto reenable immediate delivery of warm cache results. As part of this refactoring, theApolloCurrentQueryResulttype was eliminated in favor ofApolloQueryResult.
@benjamn in #6710 -
Avoid clobbering
defaultOptionswithundefinedvalues.
@benjamn in #6715
Improvements
-
Apollo Client will no longer modify
options.fetchPolicyunless you passoptions.nextFetchPolicyto request an explicit change inFetchPolicyafter the current request. Although this is technically a breaking change,options.nextFieldPolicymakes it easy to restore the old behavior (by passingcache-first).
@benjamn in #6712, reverting #6353 -
Errors of the form
Invariant Violation: 42thrown in production can now be looked up much more easily, by consulting the auto-generated@apollo/client/invariantErrorCodes.jsfile specific to your@apollo/clientversion.
@benjamn in #6665 -
Make the
clientfield of theMutationResulttype non-optional, since it is always provided.
@glasser in #6617 -
Allow passing an asynchronous
options.renderFunctiontogetMarkupFromTree.
@richardscarrott in #6576 -
Ergonomic improvements for
mergeandkeyArgsfunctions in cache field policies.
@benjamn in #6714
Apollo Client 3.0.2
Bug Fixes
- Avoid duplicating
graphql/execution/executedependency in CommonJS bundle for@apollo/client/link/schema, fixinginstanceoferrors 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]
ApolloClientis now only available as a named export. The defaultApolloClientexport has been removed.
@hwillson in #5425 -
[BREAKING] The
queryManagerproperty ofApolloClientinstances 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
ObservableQueryconsumers, 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 publicgraphQLErrorsandnetworkErrorproperties.
@lorensr in #3892 -
[BREAKING] Support for the
@livedirective 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
@clientfields to be passed into thelinkchain ifresolverswere not set in the constructor. This allowed@clientfields to be passed into Links likeapollo-link-state. Apollo Client 3 enforces that@clientfields are local only, meaning they are no longer passed into thelinkchain, under any circumstances.
@hwillson in #5982 -
[BREAKING?] Refactor
QueryManagerto make better use of observables and enforcefetchPolicymore reliably.
@benjamn in #6221 -
The
updateQueryfunction previously required byfetchMorehas been deprecated with a warning, and will be removed in the next major version of Apollo Client. Please consider using amergefunction 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 typicalupdateQueryfunctions. 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-commonandapollo-link-httppackages is now directly available from@apollo/client(e.g.import { HttpLink } from '@apollo/client'). TheApolloClientconstructor has also been updated to accept newuri,headersandcredentialsoptions. Ifuriis specified, Apollo Client will take care of creating the necessaryHttpLinkbehind the scenes.
@hwillson in #5412 -
The
gqltemplate tag should now be imported from the@apollo/clientpackage, rather than thegraphql-tagpackage. Although thegraphql-tagpackage still works for now, future versions of@apollo/clientmay change the implementation details ofgqlwithout a major version bump.
@hwillson in #5451 -
@apollo/client/corecan be used to import the Apollo Client core, which includes everything the main@apollo/clientpackage does, except for all React related functionality.
@kamilkisiela in #5541 -
Several deprecated methods have been fully removed:
ApolloClient#initQueryManagerQueryManager#startQueryObservableQuery#currentResult
-
Apollo Client now supports setting a new
ApolloLink(or link chain) afternew ApolloClient()has been called, using theApolloClient#setLinkmethod.
@hwillson in #6193 -
The final time a mutation
updatefunction 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:InMemoryCachehas 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
InMemoryCacheconstructor should now be imported directly from@apollo/client, rather than from a separate package. Theapollo-cache-inmemorypackage is no longer supported.The
@apollo/client/cacheentry point can be used to importInMemoryCachewithout importing other parts of the Apollo Client codebase.
@hwillson in #5577 -
[BREAKING]
FragmentMatcher,HeuristicFragmentMatcher, andIntrospectionFragmentMatcherhave all been removed. We now recommend usingInMemoryCache’spossibleTypesoption instead. For more information see the DefiningpossibleTypesmanually 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]
InMemoryCachewill 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 custommergefunction is defined by a field policy for that field, within a type policy associated with the__typenameof the parent object.
@benjamn in #5603 -
[BREAKING]
InMemoryCachenow 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.writeDatahave been fully removed.writeDatausage 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.modifycan be used to update the cache.
@benjamn in #5923 -
InMemoryCachenow supports tracing garbage collection and eviction. Note that the signature of theevictmethod has been simplified in a potentially backwards-incompatible way.
@benjamn in #5310 -
[beta-BREAKING] Please note that the
cache.evictmethod 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
fetchMoretype signature to acceptcontext.
@koenpunt in #5147 -
Fix type for
Resolverand use it in the definition ofResolvers.
@peoplenarthax in #4943 -
Local state resolver functions now receive a
fragmentMap: FragmentMapobject, in addition to thefield: FieldNodeobject, via theinfoparameter.
@mjlyons in #5388 -
Documentation updates.
@tomquirk in #5645
@Sequoia in #5641
@phryneas in #5628
@AryanJ-NYC in #5560
GraphQL Anywhere (4.2.6)
- Fix
filteredge case involvingnull.
@lifeiscontent in #5110
Apollo Boost (0.4.7)
-
Replace
GlobalFetchreference withWindowOrWorkerGlobalScope.
@abdonrd in #5373 -
Add
assumeImmutableResultstyping to apollo boostPresetConfiginterface.
@bencoullie in #5571