@apollo/client
Advanced tools
Comparing version 3.9.8 to 3.9.9
@@ -431,3 +431,3 @@ 'use strict'; | ||
var version = "3.9.8"; | ||
var version = "3.9.9"; | ||
@@ -434,0 +434,0 @@ function maybe(thunk) { |
{ | ||
"name": "@apollo/client", | ||
"version": "3.9.8", | ||
"version": "3.9.9", | ||
"description": "A fully-featured caching GraphQL client.", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -950,2 +950,3 @@ 'use strict'; | ||
}, [queryRef]); | ||
React__namespace.useEffect(function () { return queryRef.softRetain(); }, [queryRef]); | ||
return [ | ||
@@ -952,0 +953,0 @@ didFetchResult.current ? wrappedQueryRef : void 0, |
@@ -51,2 +51,3 @@ import { __spreadArray } from "tslib"; | ||
}, [queryRef]); | ||
React.useEffect(function () { return queryRef.softRetain(); }, [queryRef]); | ||
return [ | ||
@@ -53,0 +54,0 @@ didFetchResult.current ? wrappedQueryRef : void 0, |
@@ -79,2 +79,3 @@ import type { ApolloQueryResult, ObservableQuery, OperationVariables, WatchQueryOptions } from "../../../core/index.js"; | ||
private references; | ||
private softReferences; | ||
constructor(observable: ObservableQuery<TData, any>, options: InternalQueryReferenceOptions); | ||
@@ -85,2 +86,3 @@ get disposed(): boolean; | ||
retain(): () => void; | ||
softRetain(): () => void; | ||
didChangeOptions(watchQueryOptions: ObservedOptions): boolean; | ||
@@ -87,0 +89,0 @@ applyOptions(watchQueryOptions: ObservedOptions): QueryRefPromise<TData>; |
@@ -56,2 +56,3 @@ import { __assign } from "tslib"; | ||
this.references = 0; | ||
this.softReferences = 0; | ||
this.handleNext = this.handleNext.bind(this); | ||
@@ -136,2 +137,22 @@ this.handleError = this.handleError.bind(this); | ||
}; | ||
InternalQueryReference.prototype.softRetain = function () { | ||
var _this = this; | ||
this.softReferences++; | ||
var disposed = false; | ||
return function () { | ||
// Tracking if this has already been called helps ensure that | ||
// multiple calls to this function won't decrement the reference | ||
// counter more than it should. Subsequent calls just result in a noop. | ||
if (disposed) { | ||
return; | ||
} | ||
disposed = true; | ||
_this.softReferences--; | ||
setTimeout(function () { | ||
if (!_this.softReferences && !_this.references) { | ||
_this.dispose(); | ||
} | ||
}); | ||
}; | ||
}; | ||
InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) { | ||
@@ -138,0 +159,0 @@ var _this = this; |
@@ -50,2 +50,3 @@ 'use strict'; | ||
this.references = 0; | ||
this.softReferences = 0; | ||
this.handleNext = this.handleNext.bind(this); | ||
@@ -122,2 +123,19 @@ this.handleError = this.handleError.bind(this); | ||
}; | ||
InternalQueryReference.prototype.softRetain = function () { | ||
var _this = this; | ||
this.softReferences++; | ||
var disposed = false; | ||
return function () { | ||
if (disposed) { | ||
return; | ||
} | ||
disposed = true; | ||
_this.softReferences--; | ||
setTimeout(function () { | ||
if (!_this.softReferences && !_this.references) { | ||
_this.dispose(); | ||
} | ||
}); | ||
}; | ||
}; | ||
InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) { | ||
@@ -124,0 +142,0 @@ var _this = this; |
@@ -7,3 +7,3 @@ 'use strict'; | ||
var version = "3.9.8"; | ||
var version = "3.9.9"; | ||
@@ -10,0 +10,0 @@ function maybe(thunk) { |
@@ -1,2 +0,2 @@ | ||
export var version = "3.9.8"; | ||
export var version = "3.9.9"; | ||
//# sourceMappingURL=version.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6684931
58116