v3.7.0
版本发布时间: 2022-10-01 01:30:45
apollographql/apollo-client最新发布版本:v3.12.0-alpha.0(2024-10-02 04:16:11)
New Features (from CHANGELOG.md
)
-
Implement preview support for the
@defer
directive. @alessbell and @benjamn in #10018 -
Implement
useFragment_experimental
hook, which represents a lightweight live binding into theApolloCache
, and never triggers network requests of its own. @benjamn in #8782 -
Allow registering named fragments with
InMemoryCache
to support using...NamedFragment
in queries without redeclaringNamedFragment
repeatedly in every query that uses it. @benjamn in #9764 -
Support
onError
callback foruseSubscription
hook. @jeroenvisser101 in #9495
Improvements (from CHANGELOG.md
)
-
Delay calling
onCompleted
andonError
callbacks passed touseQuery
usingPromise.resolve().then(() => ...)
to fix issue #9794. @dylanwulf in #9823 -
Replace
concast.cleanup
method with simplerconcast.beforeNext
API, which promises to call the given callback function just before the next result/error is delivered. In addition,concast.removeObserver
no longer takes aquietly?: boolean
parameter, since that parameter was partly responsible for cleanup callbacks sometimes not getting called. @benjamn in #9718 -
Allow preserving header name capitalization when creating an
HttpLink
withcreateHttpLink({ uri, preserveHeaderCase: true })
. Otherwise, header names are converted to lowercase to prevent case-sensitivity bugs. @MrDoomBringer in #9891 -
Make queries with a
pollInterval
respect theno-cache
fetch policy, instead of writing polled results into the cache. @MrDoomBringer in #10020 -
Deprecate the
onSubscriptionData
callback in favor of a newonData
callback for theuseSubscription
hook. Deprecate theonSubscriptionComplete
callback in favor of a newonComplete
callback for theuseSubscription
hook. @jerelmiller in #10134
Potentially disruptive (from CHANGELOG.md
)
- The optional
subscribeAndCount
testing utility exported from@apollo/client/testing/core
now takes a single genericTResult
type parameter, instead ofTData
. This type will typically be inferred from theobservable
argument type, but if you have any explicit calls tosubscribeAndCount<TData>(...)
in your own codebase, you may need to adjust those calls accordingly. @benjamn in #9718
What's Changed (auto-generated by GitHub)
- Replace
concast.cleanup
method with simplerconcast.beforeNext
API by @benjamn in https://github.com/apollographql/apollo-client/pull/9718 - Implement minimal
useFragment
hook by @benjamn in https://github.com/apollographql/apollo-client/pull/8782 - Fix
BatchHttpLink
regression that silently discarded some pending queries by @benjamn in https://github.com/apollographql/apollo-client/pull/9793 - Delay execution of callback functions to fix React errors by @dylanwulf in https://github.com/apollographql/apollo-client/pull/9801
- Return most recent result diff from useFragment, update test by @alessbell in https://github.com/apollographql/apollo-client/pull/10030
- Supports "no-cache" fetchPolicy with pollInterval by @MrDoomBringer in https://github.com/apollographql/apollo-client/pull/10020
- (Release 3.7) Rename useFragment -> useFragment_experimental by @MrDoomBringer in https://github.com/apollographql/apollo-client/pull/10075
- Adds @defer support by @alessbell in https://github.com/apollographql/apollo-client/pull/10018
- Improvements to the
hasDirectives
utility function by @benjamn in https://github.com/apollographql/apollo-client/pull/10082 - chore: omit previousResult, lastCompleteResult from options/result by @alessbell in https://github.com/apollographql/apollo-client/pull/10100
- Support header name capitalization by @MrDoomBringer in https://github.com/apollographql/apollo-client/pull/9891
- Add onError option to useSubscription hook by @jeroenvisser101 in https://github.com/apollographql/apollo-client/pull/9495
- Avoid letting
defaultDataIdFromObject
normalize objects with nullish ids by @benjamn in https://github.com/apollographql/apollo-client/pull/9862 - Allow registering named fragments with
InMemoryCache
to support using...FragmentName
in queries without redeclaringFragmentName
in every query by @benjamn in https://github.com/apollographql/apollo-client/pull/9764 - Fix various flaky tests before publishing
@apollo/client@v3.7.0-rc.0
by @benjamn in https://github.com/apollographql/apollo-client/pull/10118 - Update handler names for useSubscription hook by @jerelmiller in https://github.com/apollographql/apollo-client/pull/10134
- Add changes from #10134 to CHANGELOG.md by @jerelmiller in https://github.com/apollographql/apollo-client/pull/10148
- Release 3.7.0 by @benjamn in https://github.com/apollographql/apollo-client/pull/9633
New Contributors 🎉 🙌 🥳
- @jeroenvisser101 made their first contribution in https://github.com/apollographql/apollo-client/pull/9495
- @jerelmiller made their first contribution in https://github.com/apollographql/apollo-client/pull/10134
Full Changelog: https://github.com/apollographql/apollo-client/compare/v3.6.10...v3.7.0