@apollo/client 3.9.8 → 3.9.9
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 +6 -0
- package/apollo-client.cjs +20 -1
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/core/core.cjs +1 -1
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +1 -1
- package/dev/dev.cjs +1 -1
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +1 -1
- package/package.json +1 -1
- package/react/hooks/hooks.cjs +1 -0
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +1 -0
- package/react/hooks/useBackgroundQuery.js +1 -0
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +2 -0
- package/react/internal/cache/QueryReference.js +21 -0
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/internal.cjs +18 -0
- package/react/internal/internal.cjs.map +1 -1
- package/react/internal/internal.cjs.native.js +18 -0
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +1 -1
- package/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @apollo/client
|
|
2
2
|
|
|
3
|
+
## 3.9.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#11696](https://github.com/apollographql/apollo-client/pull/11696) [`466ef82`](https://github.com/apollographql/apollo-client/commit/466ef82198486fc696da64d17d82b46140760ac4) Thanks [@PiR1](https://github.com/PiR1)! - Immediately dispose of the `queryRef` if `useBackgroundQuery` unmounts before the auto dispose timeout kicks in.
|
|
8
|
+
|
|
3
9
|
## 3.9.8
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/apollo-client.cjs
CHANGED
|
@@ -31,7 +31,7 @@ function _interopNamespace(e) {
|
|
|
31
31
|
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
32
32
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
33
33
|
|
|
34
|
-
var version = "3.9.
|
|
34
|
+
var version = "3.9.9";
|
|
35
35
|
|
|
36
36
|
function maybe(thunk) {
|
|
37
37
|
try {
|
|
@@ -8118,6 +8118,7 @@ var InternalQueryReference = (function () {
|
|
|
8118
8118
|
this.key = {};
|
|
8119
8119
|
this.listeners = new Set();
|
|
8120
8120
|
this.references = 0;
|
|
8121
|
+
this.softReferences = 0;
|
|
8121
8122
|
this.handleNext = this.handleNext.bind(this);
|
|
8122
8123
|
this.handleError = this.handleError.bind(this);
|
|
8123
8124
|
this.dispose = this.dispose.bind(this);
|
|
@@ -8189,6 +8190,23 @@ var InternalQueryReference = (function () {
|
|
|
8189
8190
|
});
|
|
8190
8191
|
};
|
|
8191
8192
|
};
|
|
8193
|
+
InternalQueryReference.prototype.softRetain = function () {
|
|
8194
|
+
var _this = this;
|
|
8195
|
+
this.softReferences++;
|
|
8196
|
+
var disposed = false;
|
|
8197
|
+
return function () {
|
|
8198
|
+
if (disposed) {
|
|
8199
|
+
return;
|
|
8200
|
+
}
|
|
8201
|
+
disposed = true;
|
|
8202
|
+
_this.softReferences--;
|
|
8203
|
+
setTimeout(function () {
|
|
8204
|
+
if (!_this.softReferences && !_this.references) {
|
|
8205
|
+
_this.dispose();
|
|
8206
|
+
}
|
|
8207
|
+
});
|
|
8208
|
+
};
|
|
8209
|
+
};
|
|
8192
8210
|
InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) {
|
|
8193
8211
|
var _this = this;
|
|
8194
8212
|
return OBSERVED_CHANGED_OPTIONS.some(function (option) {
|
|
@@ -8508,6 +8526,7 @@ function _useBackgroundQuery(query, options) {
|
|
|
8508
8526
|
setWrappedQueryRef(wrapQueryRef(queryRef));
|
|
8509
8527
|
return promise;
|
|
8510
8528
|
}, [queryRef]);
|
|
8529
|
+
React__namespace.useEffect(function () { return queryRef.softRetain(); }, [queryRef]);
|
|
8511
8530
|
return [
|
|
8512
8531
|
didFetchResult.current ? wrappedQueryRef : void 0,
|
|
8513
8532
|
{ fetchMore: fetchMore, refetch: refetch },
|