@apollo/client 3.7.12 → 3.7.14
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/apollo-client.cjs +25 -14
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js.map +1 -1
- package/core/core.cjs +1 -1
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +1 -1
- package/invariantErrorCodes.js +1 -1
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +12 -13
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +12 -13
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +12 -13
- package/link/utils/throwServerError.d.ts +1 -1
- package/link/utils/throwServerError.d.ts.map +1 -1
- package/link/utils/throwServerError.js.map +1 -1
- package/package.json +17 -17
- package/react/hooks/hooks.cjs +24 -13
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +24 -13
- package/react/hooks/useFragment.d.ts +2 -1
- package/react/hooks/useFragment.d.ts.map +1 -1
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +25 -13
- package/react/hooks/useSubscription.js.map +1 -1
- package/version.js +1 -1
package/apollo-client.cjs
CHANGED
|
@@ -1360,7 +1360,7 @@ var concat = ApolloLink.concat;
|
|
|
1360
1360
|
|
|
1361
1361
|
var execute = ApolloLink.execute;
|
|
1362
1362
|
|
|
1363
|
-
var version = '3.7.
|
|
1363
|
+
var version = '3.7.14';
|
|
1364
1364
|
|
|
1365
1365
|
function isNodeResponse(value) {
|
|
1366
1366
|
return !!value.body;
|
|
@@ -7233,9 +7233,13 @@ function useSubscription(subscription, options) {
|
|
|
7233
7233
|
if (!observable) {
|
|
7234
7234
|
return;
|
|
7235
7235
|
}
|
|
7236
|
+
var subscriptionStopped = false;
|
|
7236
7237
|
var subscription = observable.subscribe({
|
|
7237
7238
|
next: function (fetchResult) {
|
|
7238
7239
|
var _a, _b;
|
|
7240
|
+
if (subscriptionStopped) {
|
|
7241
|
+
return;
|
|
7242
|
+
}
|
|
7239
7243
|
var result = {
|
|
7240
7244
|
loading: false,
|
|
7241
7245
|
data: fetchResult.data,
|
|
@@ -7258,26 +7262,33 @@ function useSubscription(subscription, options) {
|
|
|
7258
7262
|
},
|
|
7259
7263
|
error: function (error) {
|
|
7260
7264
|
var _a, _b;
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7265
|
+
if (!subscriptionStopped) {
|
|
7266
|
+
setResult({
|
|
7267
|
+
loading: false,
|
|
7268
|
+
data: void 0,
|
|
7269
|
+
error: error,
|
|
7270
|
+
variables: options === null || options === void 0 ? void 0 : options.variables,
|
|
7271
|
+
});
|
|
7272
|
+
(_b = (_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);
|
|
7273
|
+
}
|
|
7268
7274
|
},
|
|
7269
7275
|
complete: function () {
|
|
7270
7276
|
var _a, _b;
|
|
7271
|
-
if (
|
|
7272
|
-
ref.current.options.onComplete
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
ref.current.options.onSubscriptionComplete
|
|
7277
|
+
if (!subscriptionStopped) {
|
|
7278
|
+
if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onComplete) {
|
|
7279
|
+
ref.current.options.onComplete();
|
|
7280
|
+
}
|
|
7281
|
+
else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionComplete) {
|
|
7282
|
+
ref.current.options.onSubscriptionComplete();
|
|
7283
|
+
}
|
|
7276
7284
|
}
|
|
7277
7285
|
},
|
|
7278
7286
|
});
|
|
7279
7287
|
return function () {
|
|
7280
|
-
|
|
7288
|
+
subscriptionStopped = true;
|
|
7289
|
+
setTimeout(function () {
|
|
7290
|
+
subscription.unsubscribe();
|
|
7291
|
+
});
|
|
7281
7292
|
};
|
|
7282
7293
|
}, [observable]);
|
|
7283
7294
|
return result;
|