react-apollo v3.1.0 Release Notes
Release Date: 2019-09-06 // over 4 years ago-
Potentially Breaking Change
- 🔄 Change the default query
data
state from{}
toundefined
. This change aligns all parts of the React Apollo query cycle so thatdata
is alwaysundefined
if there is no data, instead ofdata
being converted into an empty object. This change impacts the initial query response, initial SSR response,data
value when errors occur,data
value when skipping, etc. All of these areas are now aligned to only ever return a value fordata
if there really is a value to return (instead of making it seem like there is one by converting to{}
). @hwillson in #3388
🐛 Bug Fixes
- ➕ Adds support for the
skip
option when usinguseSubscription
. @n1ru4l in #3356 - ⚡️ Makes sure
refetch
,fetchMore
,updateQuery
,startPolling
,stopPolling
, andsubscribeToMore
maintain a stable identity when they're passed back alongside query results. @hwillson in #3422 - 🛠 Fixed problematic re-renders that were caused by using
fetchMore.updateQuery
withnotifyOnNetworkStatusChange
set to true. WhennotifyOnNetworkStatusChange
is true, re-renders will now wait untilupdateQuery
has completed, to make sure the updated data is used during the render. @hwillson in #3433 - ➕ Add
client
to theuseMutation
result. @joshalling in #3417 - 🛠 Prevent inline
onError
andonCompleted
callbacks from being part of the internal memoization that's used to decide when certain after render units of functionality are run, when usinguseQuery
. This fixes issues related to un-necessary component cleanup, likeerror
disappearing from results when it should be present. @dylanwulf in #3419 useLazyQuery
's execution function can now be called multiple times in a row, and will properly submit network requests each time called, when using a fetch policy ofnetwork-only
. @hwillson in #3453- 👍 SSR enhancements to support
network-only
andcache-and-network
fetch policies, along with changes to ensure disabled SSR queries are not fired. @mikebm in #3435 - ✂ Remove
void
from theMutationFunction
's returned Promise types. @hwillson in #3458 - Prevent duplicate
onCompleted
calls during the same query execution cycle. @hwillson in #3461 - 👉 Make sure polling is stopped when a component is unmounted. @dqunbp in #3273
- 📚 Documentation fixes. @SeanRoberts in #3380
- 🔄 Change the default query