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 {} to undefined. This change aligns all parts of the React Apollo query cycle so that data is always undefined if there is no data, instead of data 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 for data 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 using useSubscription. @n1ru4l in #3356
    • ⚡️ Makes sure refetch, fetchMore, updateQuery, startPolling, stopPolling, and subscribeToMore 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 with notifyOnNetworkStatusChange set to true. When notifyOnNetworkStatusChange is true, re-renders will now wait until updateQuery has completed, to make sure the updated data is used during the render. @hwillson in #3433
    • ➕ Add client to the useMutation result. @joshalling in #3417
    • 🛠 Prevent inline onError and onCompleted callbacks from being part of the internal memoization that's used to decide when certain after render units of functionality are run, when using useQuery. This fixes issues related to un-necessary component cleanup, like error 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 of network-only. @hwillson in #3453
    • 👍 SSR enhancements to support network-only and cache-and-network fetch policies, along with changes to ensure disabled SSR queries are not fired. @mikebm in #3435
    • ✂ Remove void from the MutationFunction'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