Major Changes
-
#12463
3868df8
Thanks @jerelmiller! -ObservableQuery.setOptions
has been removed as it was an alias ofreobserve
. Prefer usingreobserve
directly instead.const observable = client.watchQuery(options); // Use reobserve to set new options and reevaluate the query - observable.setOptions(newOptions); + observable.reobserve(newOptions);
As a result of this change,
reobserve
has been marked for public use and is no longer considered an internal API. ThenewNetworkStatus
argument has been removed to facilitate this change. -
#12470
d32902f
Thanks @phryneas! -ssrMode
,ssrForceFetchDelay
anddisableNetworkFetches
have been reworked:Previously, a
ObservableQuery
created byclient.query
orclient.watchQuery
while one of those were active would permanently be changed from afetchPolicy
of"network-only"
or"cache-and-network"
to"cache-first"
, and stay that way
even long afterdisableNetworkFetches
would have been deactivated.Now, the
ObservableQuery
will keep their originalfetchPolicy
, but queries
made duringdisableNetworkFetches
will just apply thefetchPolicy
replacement
at request time, just for that one request.ApolloClient.disableNetworkFetches
has been renamed toApolloClient.prioritizeCacheValues
to better reflect this behaviour. -
#12465
a132163
Thanks @jerelmiller! - Flatten out React hook types. As a result, the base types have been removed. Prefer using the hook types instead. Removed types include:BaseMutationOptions
BaseQueryOptions
BaseSubscriptionOptions
ObservableQueryFields
MutationSharedOptions
QueryFunctionOptions
-
#12463
3868df8
Thanks @jerelmiller! -useQuery
no longer returnsreobserve
as part of its result. It was possible to usereobserve
to set new options on the underlyingObservableQuery
instance which differed from the options passed to the hook. This could result in unexpected results. Instead prefer to rerender the hook with new options.
Patch Changes
- #12465
a132163
Thanks @jerelmiller! - Rename all React hook result types and options. These types have all moved under a namespace that matches the hook name. For example,useQuery
exportsuseQuery.Options
anduseQuery.Result
types. As such, the old hook types have been deprecated and will be removed in v5.