@apollo/client 3.6.9 → 3.6.10
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/README.md +3 -0
- package/apollo-client.cjs +31 -17
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +10 -6
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +10 -6
- package/cache/core/types/common.d.ts +1 -1
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/core/types/common.js +11 -6
- package/cache/core/types/common.js.map +1 -1
- package/cache/index.d.ts +1 -1
- package/cache/index.d.ts.map +1 -1
- package/cache/index.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/core/types.d.ts.map +1 -1
- package/core/types.js.map +1 -1
- package/invariantErrorCodes.js +1 -1
- package/link/http/http.cjs +11 -3
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +11 -3
- package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +11 -3
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/package.json +38 -30
- package/react/hooks/hooks.cjs +9 -7
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +9 -7
- package/react/hooks/useMutation.d.ts.map +1 -1
- package/react/hooks/useMutation.js +8 -6
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +1 -1
- package/react/hooks/useQuery.js.map +1 -1
- package/react/ssr/getDataFromTree.d.ts.map +1 -1
- package/react/ssr/getDataFromTree.js +3 -2
- package/react/ssr/getDataFromTree.js.map +1 -1
- package/react/ssr/renderToStringWithData.d.ts.map +1 -1
- package/react/ssr/renderToStringWithData.js +2 -1
- package/react/ssr/renderToStringWithData.js.map +1 -1
- package/react/ssr/ssr.cjs +4 -3
- package/react/ssr/ssr.cjs.map +1 -1
- package/react/ssr/ssr.cjs.native.js +4 -3
- package/react/types/types.d.ts +2 -3
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +1 -1
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +1 -1
- package/testing/core/itAsync.d.ts +3 -3
- package/testing/core/itAsync.d.ts.map +1 -1
- package/testing/core/mocking/mockLink.js +1 -1
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts +1 -1
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/version.js +1 -1
package/README.md
CHANGED
|
@@ -23,8 +23,11 @@ Learn how to use Apollo Client with self-paced hands-on training on Odyssey, Apo
|
|
|
23
23
|
|
|
24
24
|
- [@benjamn](https://github.com/benjamn)
|
|
25
25
|
- [@alessbell](https://github.com/alessbell)
|
|
26
|
+
- [@bignimbus](https://github.com/bignimbus)
|
|
26
27
|
- [@hwillson](https://github.com/hwillson)
|
|
27
28
|
- [@jpvajda](https://github.com/jpvajda)
|
|
29
|
+
- [@mrdoombringer](https://github.com/mrdoombringer)
|
|
30
|
+
- [@jerelmiller](https://github.com/jerelmiller)
|
|
28
31
|
|
|
29
32
|
## Who is Apollo?
|
|
30
33
|
|
package/apollo-client.cjs
CHANGED
|
@@ -1300,13 +1300,24 @@ var concat = ApolloLink.concat;
|
|
|
1300
1300
|
|
|
1301
1301
|
var execute = ApolloLink.execute;
|
|
1302
1302
|
|
|
1303
|
-
var version = '3.6.
|
|
1303
|
+
var version = '3.6.10';
|
|
1304
1304
|
|
|
1305
1305
|
var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
1306
1306
|
function parseAndCheckHttpResponse(operations) {
|
|
1307
1307
|
return function (response) { return response
|
|
1308
1308
|
.text()
|
|
1309
1309
|
.then(function (bodyText) {
|
|
1310
|
+
if (response.status >= 300) {
|
|
1311
|
+
var getResult = function () {
|
|
1312
|
+
try {
|
|
1313
|
+
return JSON.parse(bodyText);
|
|
1314
|
+
}
|
|
1315
|
+
catch (err) {
|
|
1316
|
+
return bodyText;
|
|
1317
|
+
}
|
|
1318
|
+
};
|
|
1319
|
+
throwServerError(response, getResult(), "Response not successful: Received status code ".concat(response.status));
|
|
1320
|
+
}
|
|
1310
1321
|
try {
|
|
1311
1322
|
return JSON.parse(bodyText);
|
|
1312
1323
|
}
|
|
@@ -1320,9 +1331,6 @@ function parseAndCheckHttpResponse(operations) {
|
|
|
1320
1331
|
}
|
|
1321
1332
|
})
|
|
1322
1333
|
.then(function (result) {
|
|
1323
|
-
if (response.status >= 300) {
|
|
1324
|
-
throwServerError(response, result, "Response not successful: Received status code ".concat(response.status));
|
|
1325
|
-
}
|
|
1326
1334
|
if (!Array.isArray(result) &&
|
|
1327
1335
|
!hasOwnProperty$3.call(result, 'data') &&
|
|
1328
1336
|
!hasOwnProperty$3.call(result, 'errors')) {
|
|
@@ -1682,15 +1690,19 @@ exports.Cache = void 0;
|
|
|
1682
1690
|
(function (Cache) {
|
|
1683
1691
|
})(exports.Cache || (exports.Cache = {}));
|
|
1684
1692
|
|
|
1685
|
-
var MissingFieldError = (function () {
|
|
1693
|
+
var MissingFieldError = (function (_super) {
|
|
1694
|
+
tslib.__extends(MissingFieldError, _super);
|
|
1686
1695
|
function MissingFieldError(message, path, query, variables) {
|
|
1687
|
-
this
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1696
|
+
var _this = _super.call(this, message) || this;
|
|
1697
|
+
_this.message = message;
|
|
1698
|
+
_this.path = path;
|
|
1699
|
+
_this.query = query;
|
|
1700
|
+
_this.variables = variables;
|
|
1701
|
+
_this.__proto__ = MissingFieldError.prototype;
|
|
1702
|
+
return _this;
|
|
1691
1703
|
}
|
|
1692
1704
|
return MissingFieldError;
|
|
1693
|
-
}());
|
|
1705
|
+
}(Error));
|
|
1694
1706
|
|
|
1695
1707
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
1696
1708
|
function defaultDataIdFromObject(_a, context) {
|
|
@@ -6340,7 +6352,7 @@ var InternalState = (function () {
|
|
|
6340
6352
|
InternalState.prototype.createWatchQueryOptions = function (_a) {
|
|
6341
6353
|
var _b;
|
|
6342
6354
|
if (_a === void 0) { _a = {}; }
|
|
6343
|
-
var skip = _a.skip; _a.ssr; _a.onCompleted; _a.onError; _a.
|
|
6355
|
+
var skip = _a.skip; _a.ssr; _a.onCompleted; _a.onError; _a.defaultOptions; var otherOptions = tslib.__rest(_a, ["skip", "ssr", "onCompleted", "onError", "defaultOptions"]);
|
|
6344
6356
|
var watchQueryOptions = Object.assign(otherOptions, { query: this.query });
|
|
6345
6357
|
if (this.renderPromises &&
|
|
6346
6358
|
(watchQueryOptions.fetchPolicy === 'network-only' ||
|
|
@@ -6524,7 +6536,7 @@ function useMutation(mutation, options) {
|
|
|
6524
6536
|
if (executeOptions === void 0) { executeOptions = {}; }
|
|
6525
6537
|
var _a = ref.current, client = _a.client, options = _a.options, mutation = _a.mutation;
|
|
6526
6538
|
var baseOptions = tslib.__assign(tslib.__assign({}, options), { mutation: mutation });
|
|
6527
|
-
if (!ref.current.result.loading && !baseOptions.ignoreResults) {
|
|
6539
|
+
if (!ref.current.result.loading && !baseOptions.ignoreResults && ref.current.isMounted) {
|
|
6528
6540
|
setResult(ref.current.result = {
|
|
6529
6541
|
loading: true,
|
|
6530
6542
|
error: void 0,
|
|
@@ -6554,8 +6566,8 @@ function useMutation(mutation, options) {
|
|
|
6554
6566
|
setResult(ref.current.result = result_1);
|
|
6555
6567
|
}
|
|
6556
6568
|
}
|
|
6557
|
-
(_b = (_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, response.data);
|
|
6558
|
-
(_c = executeOptions.onCompleted) === null || _c === void 0 ? void 0 : _c.call(executeOptions, response.data);
|
|
6569
|
+
(_b = (_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, response.data, clientOptions);
|
|
6570
|
+
(_c = executeOptions.onCompleted) === null || _c === void 0 ? void 0 : _c.call(executeOptions, response.data, clientOptions);
|
|
6559
6571
|
return response;
|
|
6560
6572
|
}).catch(function (error) {
|
|
6561
6573
|
var _a, _b, _c, _d;
|
|
@@ -6573,15 +6585,17 @@ function useMutation(mutation, options) {
|
|
|
6573
6585
|
}
|
|
6574
6586
|
}
|
|
6575
6587
|
if (((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError) || clientOptions.onError) {
|
|
6576
|
-
(_c = (_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onError) === null || _c === void 0 ? void 0 : _c.call(_b, error);
|
|
6577
|
-
(_d = executeOptions.onError) === null || _d === void 0 ? void 0 : _d.call(executeOptions, error);
|
|
6588
|
+
(_c = (_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onError) === null || _c === void 0 ? void 0 : _c.call(_b, error, clientOptions);
|
|
6589
|
+
(_d = executeOptions.onError) === null || _d === void 0 ? void 0 : _d.call(executeOptions, error, clientOptions);
|
|
6578
6590
|
return { data: void 0, errors: error };
|
|
6579
6591
|
}
|
|
6580
6592
|
throw error;
|
|
6581
6593
|
});
|
|
6582
6594
|
}, []);
|
|
6583
6595
|
var reset = React.useCallback(function () {
|
|
6584
|
-
|
|
6596
|
+
if (ref.current.isMounted) {
|
|
6597
|
+
setResult({ called: false, loading: false, client: client });
|
|
6598
|
+
}
|
|
6585
6599
|
}, []);
|
|
6586
6600
|
React.useEffect(function () {
|
|
6587
6601
|
ref.current.isMounted = true;
|