:recycle: React integration for Apollo Client
MockedProvider
is using the proper CJS/ESM bundle, when
referencing ApolloProvider
.
@jure in #3029.ApolloContext
definition to play a bit more nicely with
React.createContext
types.
@JoviDeCroock in #3018
graphql
HOC.
@andycarrell in #3008
MockLink
to improve
debugging experience used by MockedProvider
.apollo-client@beta
peer dep.
@brentertz in #3064
null
, when using the graphql
HOC.
@ZhengYuTay in #3056
query
being mandatory in the fetchMore
signature.
@HsuTing in #3065
Query
component to get stuck in an always
loading state, caused by receiving an error (meaning subsequent valid
responses couldn't be handled). The Query
component can now handle an
error in a response, then continue to handle a valid response afterwards.
@hwillson in #3107
Subscription
component code to avoid setting state on unmounted
component.
@jasonpaulos in #3139
loading
state for network-only
fetch policy.Could not find "client" in the context of ApolloConsumer
errors when
using MockedProvider
.
@hwillson in #2907
Query
components using a fetchPolicy
of no-cache
have their
data preserved when the components tree is re-rendered.
@hwillson in #2914
setState
in the
onError
/ onCompleted
callbacks of the Query
component.Query
component, after an error was received, variables were adjusted, and then
the good data was fetched.Query
component updates from firing (under
certain circumstances) due to the internal lastResult
value (that's used
to help prevent unnecessary re-renders) not being updated.MockedProvider
now accepts a childProps
prop that can be used to pass
props down to a child component.
@miachenmtl in #2482
onCompleted
callbacks now use a destructuring-friendly type definition.
@jozanza in #2496
@connection
directives are now properly stripped from MockedResponse
's,
when using MockedProvider
.
@ajmath in #2523
MockedProvider
has been updated to stop setting a default resolvers
value of {}
, which means by default Apollo Client 2.5 local resolver
functionality is not enabled when mocking with MockedProvider
. This allows
@client
fields to be passed through the mocked link chain, like people
were used to before AC 2.5. When using this default mode you will see a
dev only warning message about this like:
Found @client directives in query but no client resolvers were specified. You can now pass apollo-link-state resolvers to the ApolloClient constructor.
This message can be safely ignored. If you want to use MockedProvider
with AC 2.5's new local resolver functionality, you can pass your local
resolver map into the MockedProvider
resolvers
prop.
@ajmath in #2524
Improvements to the graphql
HOC generics for fetchMore
and refetch
.
@EricMcRay in #2525
The ApolloProvider
/ ApolloConsumer
implementations have been refactored
to use React 16.3's new context API.
@wzrdzl in #2540
All dependencies
and devDependencies
have been updated to their latest
versions, and related Typescript changes have been applied.
@hwillson in #2873
MockedResponse
result
when using MockedProvider
, such that every time the mocked result is returned, the function is run to calculate the result. This opens up new testing possibilities, like being able to verify if a mocked result was actually requested and received by a test.
@hwillson in #2788
onCompleted
/onError
even if Mutation
unmounts.
PR #2710
Update the typescript example app to use the raw Query component directly, with generics, to avoid generating the extra object that's created (in the compiled code) when extending the Query component as a class. @evans in #2721
Use new ApolloClient#stop
method to dispose of MockedProvider
client
instance.
PR #2741
The apollo-client
peer dependency version constraint has been updated
to require the latest version, 2.4.12. Although this update is
recommended, and we believe it is backwards compatible with other
[email protected] versions, we decided to bump the minor version of
react-apollo
(to 2.4.0) because of this new apollo-client
version
requirement.
lodash.isequal
was improperly set as a dev dependency for
MockLink
/ MockedProvider
. It is now a dependency.
@danilobuerger in #2449
Subscription
component now accepts a fetchPolicy
prop.
@MatthieuLemoine in #2298
TVariables
generic is passed to ObservableQuery
.
@tgriesser in #2311
errorPolicy
of all
.
@amacleay in #2374
<Mutation />
refetchQueries
triggered by name (string) will now use the correct variables.
@fracmal in #2422
lodash
dependency with lodash.flowright
(since that's the
only non-dev lodash
function we're dependent on). Dev lodash
dependencies have also been updated to use their individual module
equivalent.
@hwillson in #2435
rollup-plugin-babel-minify
as it's no longer being used.
@hwillson in #2436
getDataFromTree.ts
logic adjustment to avoid unnecessary calls
when a falsy element
is encountered.
@HOUCe in #2429
graphql
14 updates.
@hwillson in #2437
lodash
typings.
@williamboman in #2430
context
to MutationOptions
.
@danilobuerger in #2354
MutationOptions
changes/fixes.
@danilobuerger in #2340
allowSyntheticDefaultImports
use. Typescript's
allowSyntheticDefaultImports
compiler option is something we'd like to
start using, but we jumped the gun a bit by introducing it in
https://github.com/apollographql/react-apollo/commit/9a96519d390783dfd9a431dc2dbaa476a24f7b80.
Including it means that anyone who wants to use Typescript with React
Apollo would have to also include it in their own local tsconfig.json
, to
be able to handle default imports properly. This is because we're also using
Typescript's es2015
module
option, which means
allowSyntheticDefaultImports
has to be enabled explicitly. We've
switched back to using a combination of import * as X
and require
syntax, to work with default imports. We'll re-introduce
allowSyntheticDefaultImports
use in React Apollo 3.
@hwillson in #2438