@apollo/client 4.1.4 → 4.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/__cjs/core/ObservableQuery.cjs +13 -1
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/QueryManager.cjs +2 -3
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.cjs +5 -1
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/version.cjs +1 -1
- package/core/ObservableQuery.js +13 -1
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.js +3 -4
- package/core/QueryManager.js.map +1 -1
- package/package.json +1 -1
- package/react/hooks/useQuery.js +5 -1
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks-compiled/useQuery.js +5 -1
- package/react/hooks-compiled/useQuery.js.map +1 -1
- package/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @apollo/client
|
|
2
2
|
|
|
3
|
+
## 4.1.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#13128](https://github.com/apollographql/apollo-client/pull/13128) [`6c0b8e4`](https://github.com/apollographql/apollo-client/commit/6c0b8e4301609b62ed599340589c978e4f51f020) Thanks [@pavelivanov](https://github.com/pavelivanov)! - Fix `useQuery` hydration mismatch when `ssr: false` and `skip: true` are used together
|
|
8
|
+
|
|
9
|
+
When both options were combined, the server would return `loading: false` (because `useSSRQuery` checks `skip` first), but the client's `getServerSnapshot` was returning `ssrDisabledResult` with `loading: true`, causing a hydration mismatch.
|
|
10
|
+
|
|
11
|
+
## 4.1.5
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#13155](https://github.com/apollographql/apollo-client/pull/13155) [`3ba1583`](https://github.com/apollographql/apollo-client/commit/3ba1583f93c40343501acd9d598ce506537d1c9b) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where `useQuery` would poll with `pollInterval` when `skip` was initialized to `true`.
|
|
16
|
+
|
|
17
|
+
- [#13135](https://github.com/apollographql/apollo-client/pull/13135) [`fd42142`](https://github.com/apollographql/apollo-client/commit/fd42142495d24859a9bc7145a85bc8f8d857ec88) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue where `client.query` would apply options from `defaultOptions.watchQuery`.
|
|
18
|
+
|
|
3
19
|
## 4.1.4
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -855,7 +855,14 @@ class ObservableQuery {
|
|
|
855
855
|
return;
|
|
856
856
|
}
|
|
857
857
|
const { pollingInfo, options: { fetchPolicy, pollInterval }, } = this;
|
|
858
|
-
|
|
858
|
+
const shouldCancelPolling = () => {
|
|
859
|
+
const { options } = this;
|
|
860
|
+
return (!options.pollInterval ||
|
|
861
|
+
!this.hasObservers() ||
|
|
862
|
+
options.fetchPolicy === "cache-only" ||
|
|
863
|
+
options.fetchPolicy === "standby");
|
|
864
|
+
};
|
|
865
|
+
if (shouldCancelPolling()) {
|
|
859
866
|
if (environment_1.__DEV__) {
|
|
860
867
|
if (!this.didWarnCacheOnlyPolling &&
|
|
861
868
|
pollInterval &&
|
|
@@ -873,6 +880,11 @@ class ObservableQuery {
|
|
|
873
880
|
const info = pollingInfo || (this.pollingInfo = {});
|
|
874
881
|
info.interval = pollInterval;
|
|
875
882
|
const maybeFetch = () => {
|
|
883
|
+
// defense against options changing after the setTimeout changes in case
|
|
884
|
+
// the call site forgets to call cancelPolling
|
|
885
|
+
if (shouldCancelPolling()) {
|
|
886
|
+
return this.cancelPolling();
|
|
887
|
+
}
|
|
876
888
|
if (this.pollingInfo) {
|
|
877
889
|
if (!(0, utilities_1.isNetworkRequestInFlight)(this.networkStatus) &&
|
|
878
890
|
!this.options.skipPollAttempt?.()) {
|