Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@apollo/client

Package Overview
Dependencies
Maintainers
4
Versions
588
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apollo/client - npm Package Compare versions

Comparing version 0.0.0-pr-11713-20240320175257 to 0.0.0-pr-11719-20240322142549

2

dev/dev.cjs.native.js

@@ -431,3 +431,3 @@ 'use strict';

var version = "0.0.0-pr-11713-20240320175257";
var version = "0.0.0-pr-11719-20240322142549";

@@ -434,0 +434,0 @@ function maybe(thunk) {

{
"name": "@apollo/client",
"version": "0.0.0-pr-11713-20240320175257",
"version": "0.0.0-pr-11719-20240322142549",
"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,

import type { useQuery, useSuspenseQuery, useBackgroundQuery, useReadQuery, useFragment } from "../index.js";
import type { ApolloClient } from "../../../core/ApolloClient.js";
import type { ObservableQuery } from "../../../core/ObservableQuery.js";
import type { createQueryPreloader } from "../../query-preloader/createQueryPreloader.js";
interface WrappableHooks {
createQueryPreloader: typeof createQueryPreloader;
useQuery: typeof useQuery;

@@ -6,0 +8,0 @@ useSuspenseQuery: typeof useSuspenseQuery;

@@ -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) {

@@ -242,3 +263,3 @@ var _this = this;

returnedPromise
.then(function (result) {
.then(function () {
// In the case of `fetchMore`, this promise is resolved before a cache

@@ -257,4 +278,12 @@ // result is emitted due to the fact that `fetchMore` sets a `no-cache`

if (_this.promise.status === "pending") {
_this.result = result;
(_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, result);
// Use the current result from the observable instead of the value
// resolved from the promise. This avoids issues in some cases where
// the raw resolved value should not be the emitted value, such as
// when a `fetchMore` call returns an empty array after it has
// reached the end of the list.
//
// See the following for more information:
// https://github.com/apollographql/apollo-client/issues/11642
_this.result = _this.observable.getCurrentResult();
(_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, _this.result);
}

@@ -261,0 +290,0 @@ });

@@ -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) {

@@ -213,8 +231,8 @@ var _this = this;

returnedPromise
.then(function (result) {
.then(function () {
setTimeout(function () {
var _a;
if (_this.promise.status === "pending") {
_this.result = result;
(_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, result);
_this.result = _this.observable.getCurrentResult();
(_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, _this.result);
}

@@ -221,0 +239,0 @@ });

import { __assign } from "tslib";
import { InternalQueryReference, wrapQueryRef } from "../internal/index.js";
import { wrapHook } from "../hooks/internal/index.js";
/**

@@ -23,2 +24,5 @@ * A higher order function that returns a `preloadQuery` function which

export function createQueryPreloader(client) {
return wrapHook("createQueryPreloader", _createQueryPreloader, client)(client);
}
var _createQueryPreloader = function (client) {
return function preloadQuery(query, options) {

@@ -32,3 +36,3 @@ var _a, _b;

};
}
};
//# sourceMappingURL=createQueryPreloader.js.map

@@ -12,3 +12,14 @@ 'use strict';

var wrapperSymbol = Symbol.for("apollo.hook.wrappers");
function wrapHook(hookName, useHook, clientOrObsQuery) {
var queryManager = clientOrObsQuery["queryManager"];
var wrappers = queryManager && queryManager[wrapperSymbol];
var wrapper = wrappers && wrappers[hookName];
return wrapper ? wrapper(useHook) : useHook;
}
function createQueryPreloader(client) {
return wrapHook("createQueryPreloader", _createQueryPreloader, client)(client);
}
var _createQueryPreloader = function (client) {
return function preloadQuery(query, options) {

@@ -22,3 +33,3 @@ var _a, _b;

};
}
};

@@ -25,0 +36,0 @@ exports.ApolloConsumer = context.ApolloConsumer;

@@ -7,3 +7,3 @@ 'use strict';

var version = "0.0.0-pr-11713-20240320175257";
var version = "0.0.0-pr-11719-20240322142549";

@@ -10,0 +10,0 @@ function maybe(thunk) {

@@ -1,2 +0,2 @@

export var version = "0.0.0-pr-11713-20240320175257";
export var version = "0.0.0-pr-11719-20240322142549";
//# 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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc