Change8

v4.0.0-alpha.9

Breaking Changes
📦 apollo-client
1 breaking2 features🐛 4 fixes🔧 6 symbols

Summary

This release introduces automatic loading state emission by default and adds initial loading support for ObservableQuery, while fixing several useLazyQuery and polling behaviors.

⚠️ Breaking Changes

  • notifyOnNetworkStatusChange now defaults to true, causing loading states to be emitted by default. To retain the previous behavior set notifyOnNetworkStatusChange to false in defaultOptions.watchQuery.

Migration Steps

  1. If you relied on the old default (false), add notifyOnNetworkStatusChange: false to your ApolloClient defaultOptions.watchQuery configuration.

✨ New Features

  • ObservableQuery now emits an initial loading state when subscribing if notifyOnNetworkStatusChange is true.
  • notifyOnNetworkStatusChange default changed to true, so loading states are emitted automatically for refetch, fetchMore, etc.

🐛 Bug Fixes

  • useLazyQuery now sets the returned networkStatus to setVariables when the execute function is called for the first time with variables.
  • ObservableQuery stops polling when switching to a standby fetchPolicy and resumes polling when switching back to a non-standby fetchPolicy.
  • useLazyQuery now emits a loading state when the execute function is called after changing clients.
  • useLazyQuery no longer returns a partial property that is not specified by the result type.

🔧 Affected Symbols

ObservableQueryuseLazyQuerynotifyOnNetworkStatusChangeApolloClientfetchPolicynetworkStatus