@apollo/client 3.7.2 → 3.7.4

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.
Files changed (51) hide show
  1. package/README.md +8 -7
  2. package/apollo-client.cjs +147 -63
  3. package/apollo-client.cjs.map +1 -1
  4. package/apollo-client.min.cjs +1 -1
  5. package/core/QueryInfo.d.ts.map +1 -1
  6. package/core/QueryInfo.js +8 -17
  7. package/core/QueryInfo.js.map +1 -1
  8. package/core/QueryManager.d.ts.map +1 -1
  9. package/core/QueryManager.js +52 -27
  10. package/core/QueryManager.js.map +1 -1
  11. package/core/core.cjs +147 -44
  12. package/core/core.cjs.map +1 -1
  13. package/core/core.cjs.native.js +147 -44
  14. package/invariantErrorCodes.js +1 -1
  15. package/package.json +16 -10
  16. package/react/hooks/hooks.cjs +44 -15
  17. package/react/hooks/hooks.cjs.map +1 -1
  18. package/react/hooks/hooks.cjs.native.js +44 -15
  19. package/react/hooks/useLazyQuery.d.ts.map +1 -1
  20. package/react/hooks/useLazyQuery.js +19 -4
  21. package/react/hooks/useLazyQuery.js.map +1 -1
  22. package/react/hooks/useMutation.d.ts.map +1 -1
  23. package/react/hooks/useMutation.js +7 -7
  24. package/react/hooks/useMutation.js.map +1 -1
  25. package/react/hooks/useQuery.d.ts +2 -1
  26. package/react/hooks/useQuery.d.ts.map +1 -1
  27. package/react/hooks/useQuery.js +19 -5
  28. package/react/hooks/useQuery.js.map +1 -1
  29. package/testing/core/core.cjs +17 -0
  30. package/testing/core/core.cjs.map +1 -1
  31. package/testing/core/core.cjs.native.js +17 -0
  32. package/testing/core/index.d.ts +1 -0
  33. package/testing/core/index.d.ts.map +1 -1
  34. package/testing/core/index.js +1 -0
  35. package/testing/core/index.js.map +1 -1
  36. package/testing/core/wait.d.ts +3 -0
  37. package/testing/core/wait.d.ts.map +1 -0
  38. package/testing/core/wait.js +16 -0
  39. package/testing/core/wait.js.map +1 -0
  40. package/utilities/common/errorHandling.d.ts +3 -2
  41. package/utilities/common/errorHandling.d.ts.map +1 -1
  42. package/utilities/common/errorHandling.js +18 -1
  43. package/utilities/common/errorHandling.js.map +1 -1
  44. package/utilities/common/incrementalResult.d.ts +5 -2
  45. package/utilities/common/incrementalResult.d.ts.map +1 -1
  46. package/utilities/common/incrementalResult.js +29 -1
  47. package/utilities/common/incrementalResult.js.map +1 -1
  48. package/utilities/utilities.cjs +21 -1
  49. package/utilities/utilities.cjs.map +1 -1
  50. package/utilities/utilities.cjs.native.js +21 -1
  51. package/version.js +1 -1
@@ -15,10 +15,99 @@ var utils = require('../link/utils');
15
15
  var tsInvariant = require('ts-invariant');
16
16
  var graphqlTag = require('graphql-tag');
17
17
 
18
- var version = '3.7.2';
18
+ var version = '3.7.4';
19
+
20
+ function isNonEmptyArray(value) {
21
+ return Array.isArray(value) && value.length > 0;
22
+ }
23
+
24
+ function isNonNullObject(obj) {
25
+ return obj !== null && typeof obj === 'object';
26
+ }
27
+
28
+ var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
29
+ var defaultReconciler = function (target, source, property) {
30
+ return this.merge(target[property], source[property]);
31
+ };
32
+ var DeepMerger = (function () {
33
+ function DeepMerger(reconciler) {
34
+ if (reconciler === void 0) { reconciler = defaultReconciler; }
35
+ this.reconciler = reconciler;
36
+ this.isObject = isNonNullObject;
37
+ this.pastCopies = new Set();
38
+ }
39
+ DeepMerger.prototype.merge = function (target, source) {
40
+ var _this = this;
41
+ var context = [];
42
+ for (var _i = 2; _i < arguments.length; _i++) {
43
+ context[_i - 2] = arguments[_i];
44
+ }
45
+ if (isNonNullObject(source) && isNonNullObject(target)) {
46
+ Object.keys(source).forEach(function (sourceKey) {
47
+ if (hasOwnProperty$2.call(target, sourceKey)) {
48
+ var targetValue = target[sourceKey];
49
+ if (source[sourceKey] !== targetValue) {
50
+ var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, source, sourceKey], context, false));
51
+ if (result !== targetValue) {
52
+ target = _this.shallowCopyForMerge(target);
53
+ target[sourceKey] = result;
54
+ }
55
+ }
56
+ }
57
+ else {
58
+ target = _this.shallowCopyForMerge(target);
59
+ target[sourceKey] = source[sourceKey];
60
+ }
61
+ });
62
+ return target;
63
+ }
64
+ return source;
65
+ };
66
+ DeepMerger.prototype.shallowCopyForMerge = function (value) {
67
+ if (isNonNullObject(value)) {
68
+ if (!this.pastCopies.has(value)) {
69
+ if (Array.isArray(value)) {
70
+ value = value.slice(0);
71
+ }
72
+ else {
73
+ value = tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value);
74
+ }
75
+ this.pastCopies.add(value);
76
+ }
77
+ }
78
+ return value;
79
+ };
80
+ return DeepMerger;
81
+ }());
19
82
 
20
83
  function isExecutionPatchIncrementalResult(value) {
21
- return !!value.incremental;
84
+ return "incremental" in value;
85
+ }
86
+ function isExecutionPatchInitialResult(value) {
87
+ return "hasNext" in value && "data" in value;
88
+ }
89
+ function isExecutionPatchResult(value) {
90
+ return (isExecutionPatchIncrementalResult(value) ||
91
+ isExecutionPatchInitialResult(value));
92
+ }
93
+ function mergeIncrementalData(prevResult, result) {
94
+ var mergedData = prevResult;
95
+ var merger = new DeepMerger();
96
+ if (isExecutionPatchIncrementalResult(result) &&
97
+ isNonEmptyArray(result.incremental)) {
98
+ result.incremental.forEach(function (_a) {
99
+ var data = _a.data, path = _a.path;
100
+ for (var i = path.length - 1; i >= 0; --i) {
101
+ var key = path[i];
102
+ var isNumericKey = !isNaN(+key);
103
+ var parent_1 = isNumericKey ? [] : {};
104
+ parent_1[key] = data;
105
+ data = parent_1;
106
+ }
107
+ mergedData = merger.merge(mergedData, data);
108
+ });
109
+ }
110
+ return mergedData;
22
111
  }
23
112
 
24
113
  exports.NetworkStatus = void 0;
@@ -983,28 +1072,18 @@ var QueryInfo = (function () {
983
1072
  };
984
1073
  QueryInfo.prototype.markResult = function (result, document, options, cacheWriteBehavior) {
985
1074
  var _this = this;
1075
+ var merger = new utilities.DeepMerger();
986
1076
  var graphQLErrors = utilities.isNonEmptyArray(result.errors)
987
1077
  ? result.errors.slice(0)
988
1078
  : [];
989
1079
  this.reset();
990
1080
  if ('incremental' in result && utilities.isNonEmptyArray(result.incremental)) {
991
- var mergedData_1 = this.getDiff().result;
992
- var merger_1 = new utilities.DeepMerger();
993
- result.incremental.forEach(function (_a) {
994
- var data = _a.data, path = _a.path, errors = _a.errors;
995
- for (var i = path.length - 1; i >= 0; --i) {
996
- var key = path[i];
997
- var isNumericKey = !isNaN(+key);
998
- var parent_1 = isNumericKey ? [] : {};
999
- parent_1[key] = data;
1000
- data = parent_1;
1001
- }
1002
- if (errors) {
1003
- graphQLErrors.push.apply(graphQLErrors, errors);
1004
- }
1005
- mergedData_1 = merger_1.merge(mergedData_1, data);
1006
- });
1007
- result.data = mergedData_1;
1081
+ var mergedData = mergeIncrementalData(this.getDiff().result, result);
1082
+ result.data = mergedData;
1083
+ }
1084
+ else if ('hasNext' in result && result.hasNext) {
1085
+ var diff = this.getDiff();
1086
+ result.data = merger.merge(diff.result, result.data);
1008
1087
  }
1009
1088
  this.graphQLErrors = graphQLErrors;
1010
1089
  if (options.fetchPolicy === 'no-cache') {
@@ -1161,7 +1240,7 @@ var QueryManager = (function () {
1161
1240
  return utilities.asyncMap(self.getObservableFromLink(mutation, tslib.__assign(tslib.__assign({}, context), { optimisticResponse: optimisticResponse }), variables, false), function (result) {
1162
1241
  if (utilities.graphQLResultHasError(result) && errorPolicy === 'none') {
1163
1242
  throw new errors.ApolloError({
1164
- graphQLErrors: result.errors,
1243
+ graphQLErrors: utilities.getGraphQLErrorsFromResult(result),
1165
1244
  });
1166
1245
  }
1167
1246
  if (mutationStoreValue) {
@@ -1195,7 +1274,9 @@ var QueryManager = (function () {
1195
1274
  }).subscribe({
1196
1275
  next: function (storeResult) {
1197
1276
  self.broadcastQueries();
1198
- resolve(storeResult);
1277
+ if (!('hasNext' in storeResult) || storeResult.hasNext === false) {
1278
+ resolve(storeResult);
1279
+ }
1199
1280
  },
1200
1281
  error: function (err) {
1201
1282
  if (mutationStoreValue) {
@@ -1223,12 +1304,33 @@ var QueryManager = (function () {
1223
1304
  var cacheWrites = [];
1224
1305
  var skipCache = mutation.fetchPolicy === "no-cache";
1225
1306
  if (!skipCache && shouldWriteResult(result, mutation.errorPolicy)) {
1226
- cacheWrites.push({
1227
- result: result.data,
1228
- dataId: 'ROOT_MUTATION',
1229
- query: mutation.document,
1230
- variables: mutation.variables,
1231
- });
1307
+ if (!isExecutionPatchIncrementalResult(result)) {
1308
+ cacheWrites.push({
1309
+ result: result.data,
1310
+ dataId: 'ROOT_MUTATION',
1311
+ query: mutation.document,
1312
+ variables: mutation.variables,
1313
+ });
1314
+ }
1315
+ if (isExecutionPatchIncrementalResult(result) && utilities.isNonEmptyArray(result.incremental)) {
1316
+ var diff = cache.diff({
1317
+ id: "ROOT_MUTATION",
1318
+ query: this.transform(mutation.document).asQuery,
1319
+ variables: mutation.variables,
1320
+ optimistic: false,
1321
+ returnPartialData: true,
1322
+ });
1323
+ var mergedData = mergeIncrementalData(diff.result, result);
1324
+ if (typeof mergedData !== 'undefined') {
1325
+ result.data = mergedData;
1326
+ cacheWrites.push({
1327
+ result: mergedData,
1328
+ dataId: 'ROOT_MUTATION',
1329
+ query: mutation.document,
1330
+ variables: mutation.variables,
1331
+ });
1332
+ }
1333
+ }
1232
1334
  var updateQueries_1 = mutation.updateQueries;
1233
1335
  if (updateQueries_1) {
1234
1336
  this.queries.forEach(function (_a, queryId) {
@@ -1275,6 +1377,8 @@ var QueryManager = (function () {
1275
1377
  cacheWrites.forEach(function (write) { return cache.write(write); });
1276
1378
  }
1277
1379
  var update = mutation.update;
1380
+ var isFinalResult = !isExecutionPatchResult(result) ||
1381
+ (isExecutionPatchIncrementalResult(result) && !result.hasNext);
1278
1382
  if (update) {
1279
1383
  if (!skipCache) {
1280
1384
  var diff = cache.diff({
@@ -1284,16 +1388,24 @@ var QueryManager = (function () {
1284
1388
  optimistic: false,
1285
1389
  returnPartialData: true,
1286
1390
  });
1287
- if (diff.complete && !(isExecutionPatchIncrementalResult(result))) {
1391
+ if (diff.complete) {
1288
1392
  result = tslib.__assign(tslib.__assign({}, result), { data: diff.result });
1393
+ if ('incremental' in result) {
1394
+ delete result.incremental;
1395
+ }
1396
+ if ('hasNext' in result) {
1397
+ delete result.hasNext;
1398
+ }
1289
1399
  }
1290
1400
  }
1291
- update(cache, result, {
1292
- context: mutation.context,
1293
- variables: mutation.variables,
1294
- });
1401
+ if (isFinalResult) {
1402
+ update(cache, result, {
1403
+ context: mutation.context,
1404
+ variables: mutation.variables,
1405
+ });
1406
+ }
1295
1407
  }
1296
- if (!skipCache && !mutation.keepRootFields) {
1408
+ if (!skipCache && !mutation.keepRootFields && isFinalResult) {
1297
1409
  cache.modify({
1298
1410
  id: 'ROOT_MUTATION',
1299
1411
  fields: function (value, _a) {
@@ -1661,17 +1773,8 @@ var QueryManager = (function () {
1661
1773
  var requestId = queryInfo.lastRequestId = this.generateRequestId();
1662
1774
  var linkDocument = this.cache.transformForLink(this.transform(queryInfo.document).document);
1663
1775
  return utilities.asyncMap(this.getObservableFromLink(linkDocument, options.context, options.variables), function (result) {
1664
- var graphQLErrors = utilities.isNonEmptyArray(result.errors)
1665
- ? result.errors.slice(0)
1666
- : [];
1667
- if ('incremental' in result && utilities.isNonEmptyArray(result.incremental)) {
1668
- result.incremental.forEach(function (incrementalResult) {
1669
- if (incrementalResult.errors) {
1670
- graphQLErrors.push.apply(graphQLErrors, incrementalResult.errors);
1671
- }
1672
- });
1673
- }
1674
- var hasErrors = utilities.isNonEmptyArray(graphQLErrors);
1776
+ var graphQLErrors = utilities.getGraphQLErrorsFromResult(result);
1777
+ var hasErrors = graphQLErrors.length > 0;
1675
1778
  if (requestId >= queryInfo.lastRequestId) {
1676
1779
  if (hasErrors && options.errorPolicy === "none") {
1677
1780
  throw queryInfo.markError(new errors.ApolloError({
@@ -5,7 +5,7 @@
5
5
  // consult the @apollo/client/invariantErrorCodes.js file specific to
6
6
  // your @apollo/client version. This file is not meant to be imported.
7
7
  {
8
- "@apollo/client version": "3.7.2",
8
+ "@apollo/client version": "3.7.4",
9
9
 
10
10
  1: {
11
11
  file: "@apollo/client/cache/inmemory/entityStore.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo/client",
3
- "version": "3.7.2",
3
+ "version": "3.7.4",
4
4
  "description": "A fully-featured caching GraphQL client.",
5
5
  "private": false,
6
6
  "keywords": [
@@ -66,47 +66,53 @@
66
66
  "zen-observable-ts": "^1.2.5"
67
67
  },
68
68
  "devDependencies": {
69
- "@babel/parser": "7.20.5",
70
- "@graphql-tools/schema": "9.0.10",
69
+ "@babel/parser": "7.20.7",
70
+ "@changesets/changelog-github": "0.4.8",
71
+ "@changesets/cli": "2.26.0",
72
+ "@graphql-tools/schema": "9.0.12",
71
73
  "@rollup/plugin-node-resolve": "11.2.1",
72
74
  "@testing-library/react": "13.4.0",
73
75
  "@testing-library/react-12": "npm:@testing-library/react@^12",
74
- "@testing-library/react-hooks": "8.0.1",
75
76
  "@testing-library/user-event": "14.4.3",
76
77
  "@types/bytes": "3.1.1",
77
78
  "@types/fast-json-stable-stringify": "2.0.0",
78
79
  "@types/fetch-mock": "7.3.5",
79
80
  "@types/glob": "8.0.0",
80
81
  "@types/hoist-non-react-statics": "3.3.1",
81
- "@types/jest": "29.2.3",
82
+ "@types/jest": "29.2.5",
82
83
  "@types/lodash": "4.14.191",
83
- "@types/node": "16.18.4",
84
+ "@types/node": "18.11.18",
84
85
  "@types/node-fetch": "2.6.2",
85
86
  "@types/react": "18.0.26",
86
- "@types/react-dom": "18.0.9",
87
+ "@types/react-dom": "18.0.10",
87
88
  "@types/use-sync-external-store": "0.0.3",
89
+ "@typescript-eslint/eslint-plugin": "5.48.1",
90
+ "@typescript-eslint/parser": "5.48.1",
88
91
  "acorn": "8.8.1",
89
92
  "blob-polyfill": "7.0.20220408",
90
93
  "bytes": "3.1.2",
91
94
  "cross-fetch": "3.1.5",
95
+ "eslint": "8.31.0",
96
+ "eslint-plugin-testing-library": "5.9.1",
92
97
  "fetch-mock": "9.11.0",
93
98
  "glob": "8.0.3",
94
99
  "graphql": "16.6.0",
95
100
  "graphql-ws": "5.11.2",
96
101
  "jest": "29.3.1",
97
102
  "jest-environment-jsdom": "29.3.1",
98
- "jest-junit": "14.0.1",
103
+ "jest-junit": "15.0.0",
99
104
  "lodash": "4.17.21",
105
+ "patch-package": "6.5.1",
100
106
  "react": "18.2.0",
101
107
  "react-17": "npm:react@^17",
102
108
  "react-dom": "18.2.0",
103
109
  "react-dom-17": "npm:react-dom@^17",
104
- "recast": "0.21.5",
110
+ "recast": "0.22.0",
105
111
  "resolve": "1.22.1",
106
112
  "rimraf": "3.0.2",
107
113
  "rollup": "2.79.1",
108
114
  "rollup-plugin-terser": "7.0.2",
109
- "rxjs": "7.6.0",
115
+ "rxjs": "7.8.0",
110
116
  "subscriptions-transport-ws": "0.11.0",
111
117
  "terser": "5.16.1",
112
118
  "ts-jest": "29.0.3",
@@ -128,11 +128,19 @@ var InternalState = (function () {
128
128
  InternalState.prototype.forceUpdate = function () {
129
129
  __DEV__ && globals.invariant.warn("Calling default no-op implementation of InternalState#forceUpdate");
130
130
  };
131
- InternalState.prototype.asyncUpdate = function () {
131
+ InternalState.prototype.asyncUpdate = function (signal) {
132
132
  var _this = this;
133
- return new Promise(function (resolve) {
133
+ return new Promise(function (resolve, reject) {
134
+ var watchQueryOptions = _this.watchQueryOptions;
135
+ var handleAborted = function () {
136
+ _this.asyncResolveFns.delete(resolve);
137
+ _this.optionsToIgnoreOnce.delete(watchQueryOptions);
138
+ signal.removeEventListener('abort', handleAborted);
139
+ reject(signal.reason);
140
+ };
134
141
  _this.asyncResolveFns.add(resolve);
135
- _this.optionsToIgnoreOnce.add(_this.watchQueryOptions);
142
+ _this.optionsToIgnoreOnce.add(watchQueryOptions);
143
+ signal.addEventListener('abort', handleAborted);
136
144
  _this.forceUpdate();
137
145
  });
138
146
  };
@@ -309,9 +317,10 @@ var InternalState = (function () {
309
317
  InternalState.prototype.handleErrorOrCompleted = function (result) {
310
318
  var _this = this;
311
319
  if (!result.loading) {
320
+ var error_1 = this.toApolloError(result);
312
321
  Promise.resolve().then(function () {
313
- if (result.error) {
314
- _this.onError(result.error);
322
+ if (error_1) {
323
+ _this.onError(error_1);
315
324
  }
316
325
  else if (result.data) {
317
326
  _this.onCompleted(result.data);
@@ -321,6 +330,11 @@ var InternalState = (function () {
321
330
  });
322
331
  }
323
332
  };
333
+ InternalState.prototype.toApolloError = function (result) {
334
+ return utilities.isNonEmptyArray(result.errors)
335
+ ? new errors.ApolloError({ graphQLErrors: result.errors })
336
+ : result.error;
337
+ };
324
338
  InternalState.prototype.getCurrentResult = function () {
325
339
  if (!this.result) {
326
340
  this.handleErrorOrCompleted(this.result = this.observable.getCurrentResult());
@@ -363,6 +377,7 @@ var EAGER_METHODS = [
363
377
  'subscribeToMore',
364
378
  ];
365
379
  function useLazyQuery(query, options) {
380
+ var abortControllersRef = React.useRef(new Set());
366
381
  var internalState = useInternalState(useApolloClient(options && options.client), query);
367
382
  var execOptionsRef = React.useRef();
368
383
  var merged = execOptionsRef.current
@@ -393,14 +408,28 @@ function useLazyQuery(query, options) {
393
408
  return eagerMethods;
394
409
  }, []);
395
410
  Object.assign(result, eagerMethods);
411
+ React.useEffect(function () {
412
+ return function () {
413
+ abortControllersRef.current.forEach(function (controller) {
414
+ controller.abort();
415
+ });
416
+ };
417
+ }, []);
396
418
  var execute = React.useCallback(function (executeOptions) {
419
+ var controller = new AbortController();
420
+ abortControllersRef.current.add(controller);
397
421
  execOptionsRef.current = executeOptions ? tslib.__assign(tslib.__assign({}, executeOptions), { fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy }) : {
398
422
  fetchPolicy: initialFetchPolicy,
399
423
  };
400
424
  var promise = internalState
401
- .asyncUpdate()
402
- .then(function (queryResult) { return Object.assign(queryResult, eagerMethods); });
403
- promise.catch(function () { });
425
+ .asyncUpdate(controller.signal)
426
+ .then(function (queryResult) {
427
+ abortControllersRef.current.delete(controller);
428
+ return Object.assign(queryResult, eagerMethods);
429
+ });
430
+ promise.catch(function () {
431
+ abortControllersRef.current.delete(controller);
432
+ });
404
433
  return promise;
405
434
  }, []);
406
435
  return [execute, result];
@@ -441,7 +470,7 @@ function useMutation(mutation, options) {
441
470
  var mutationId = ++ref.current.mutationId;
442
471
  var clientOptions = core.mergeOptions(baseOptions, executeOptions);
443
472
  return client.mutate(clientOptions).then(function (response) {
444
- var _a, _b, _c;
473
+ var _a;
445
474
  var data = response.data, errors$1 = response.errors;
446
475
  var error = errors$1 && errors$1.length > 0
447
476
  ? new errors.ApolloError({ graphQLErrors: errors$1 })
@@ -459,11 +488,11 @@ function useMutation(mutation, options) {
459
488
  setResult(ref.current.result = result_1);
460
489
  }
461
490
  }
462
- (_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);
463
- (_c = executeOptions.onCompleted) === null || _c === void 0 ? void 0 : _c.call(executeOptions, response.data, clientOptions);
491
+ var onCompleted = executeOptions.onCompleted || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onCompleted);
492
+ onCompleted === null || onCompleted === void 0 ? void 0 : onCompleted(response.data, clientOptions);
464
493
  return response;
465
494
  }).catch(function (error) {
466
- var _a, _b, _c, _d;
495
+ var _a;
467
496
  if (mutationId === ref.current.mutationId &&
468
497
  ref.current.isMounted) {
469
498
  var result_2 = {
@@ -477,9 +506,9 @@ function useMutation(mutation, options) {
477
506
  setResult(ref.current.result = result_2);
478
507
  }
479
508
  }
480
- if (((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError) || clientOptions.onError) {
481
- (_c = (_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onError) === null || _c === void 0 ? void 0 : _c.call(_b, error, clientOptions);
482
- (_d = executeOptions.onError) === null || _d === void 0 ? void 0 : _d.call(executeOptions, error, clientOptions);
509
+ var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError);
510
+ if (onError) {
511
+ onError(error, clientOptions);
483
512
  return { data: void 0, errors: error };
484
513
  }
485
514
  throw error;