Update react-apollo in / from 2.0.1 to 2.2.0 #200
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dependencies.io has updated
react-apollo
(a npm dependency in/
) from "2.0.1" to "2.2.0".2.2.0
New Functionality
<Subscription />
component now allows the registration of a callbackfunction, that will be triggered each time the component receives data. The
callback
options
object param consists of the current Apollo Clientinstance in
client
, and the received subscription data insubscriptionData
.jedwards1211 in #1966
graphql
options
object is no longer mutated, when calculatingvariables from props. This now prevents an issue where components created
with
graphql
were not having their query variables updated properly, whenprops changed.
ksmth in #1968
data
was beingreturned as
undefined
. This behavior has been changed so thatdata
isreturned as an empty object. This makes checking for data (e.g.
instead of
data && data.user
you can just checkdata.user
) anddestructring (e.g.
{ data: { user } }
) easier. Note: this couldpotentially hurt applications that are relying on a falsey check of
data
to see if any query errors have occurred. A better (and supported) way to
check for errors is to use the result
errors
property.TLadd in #1983
lodash
directly.shahyar in #2045
<Subscription />
,<Query />
&<Mutation />
all supportusing an Apollo Client instance configured in the
context
or viaprops.
quentin- in #1956
<Query />
onCompleted
andonError
callbacks to be triggeredvia the
componentDidUpdate
lifecycle method. This ensures these callbackscan be used when data is fetched over the network, and when data is
fetched from the local store (previsouly these callbacks were only being
triggered when data was fetched over the network).
olistic in #2190
lodash/flowRight
using ES import to allow for treeshaking.Pajn in #2332
partialRefetch
prop (false
by default).When a
Query
component is mounted, and a mutation is executedthat returns the same ID as the mounted
Query
, but has lessfields in its result, Apollo Client's
QueryManager
returns thedata as an empty Object since a hit can't be found in the cache.
This can lead to application errors when the UI elements rendered by
the original
Query
component are expecting certain data values toexist, and they're all of a sudden stripped away. The recommended way to
handle this is to use the mutations
update
prop to reconcile the mutationresult with the data in the cache, getting everything into the expected
state. This can definitely be a cumbersome process however, so to help
address this the
partialRefetch
prop can be used to automaticallyrefetch
the original query and update the cache.steelbrain in #2003
Bug Fixes
Query
skip
prop is set totrue
, make sure the render proploading
param is set tofalse
, since we're not actually loadinganything.
edorivai in #1916
variables
passed ingraphql
HOCoptions
werenot merged with mutation
variables
.samginn in #2216
Testing
excitement-engineer in #1998
cache
object to be passed into the test-utilsMockedProvider
.palmfjord in #2254
MockedProvider
mocks
prop read only.amacleay in #2284
Typescript
Deprecated
MutationFunc
in favor ofMutationFn
.Added missing
onCompleted
andonError
callbacks toMutationOpts
.danilobuerger in #2322
FetchMoreOptions
andFetchMoreQueryOptions
types, andinstead import them from Apollo Client.
skovy in #2281
graphql
HOCoptions.skip
property.jameslaneconkling in #2208
Partial<TData>
instead ofTData | {}
, for theQueryResult
data
property.tgriesser in #2313
Infrastructure
hwillson in #2404