@apollo/client 3.11.1 → 3.11.3
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/CHANGELOG.md +22 -0
- package/apollo-client.cjs +106 -87
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/core/ObservableQuery.js +72 -43
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.js +19 -11
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +62 -43
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +62 -43
- package/dev/dev.cjs +72 -67
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +72 -67
- package/invariantErrorCodes.js +72 -66
- package/link/core/ApolloLink.js +2 -2
- package/link/core/core.cjs +2 -2
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +2 -2
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.js +1 -1
- package/link/http/http.cjs +3 -3
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +3 -3
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/persisted-queries/persisted-queries.cjs +2 -2
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
- package/link/utils/toPromise.js +1 -1
- package/link/utils/utils.cjs +2 -2
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +2 -2
- package/link/utils/validateOperation.js +1 -1
- package/package.json +7 -7
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloContext.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs +3 -3
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +3 -3
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc.cjs +2 -2
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +2 -2
- package/react/hoc/withApollo.js +1 -1
- package/react/hooks/hooks.cjs +10 -10
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +10 -10
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useLoadableQuery.js +2 -2
- package/react/hooks/useSubscription.js +4 -4
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +2 -2
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/internal/cache/QueryReference.js +1 -1
- package/react/internal/internal.cjs +2 -2
- package/react/internal/internal.cjs.map +1 -1
- package/react/internal/internal.cjs.native.js +2 -2
- package/react/parser/index.js +5 -5
- package/react/parser/parser.cjs +5 -5
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +5 -5
- package/testing/core/core.cjs +2 -2
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +2 -2
- package/testing/core/mocking/mockLink.js +2 -2
- package/testing/internal/scenarios/index.d.ts +5 -0
- package/testing/internal/scenarios/index.js +1 -1
- package/testing/internal/scenarios/index.js.map +1 -1
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +1 -1
- package/utilities/graphql/DocumentTransform.js +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/utilities.cjs +19 -19
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +19 -19
- package/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @apollo/client
|
|
2
2
|
|
|
3
|
+
## 3.11.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#11984](https://github.com/apollographql/apollo-client/pull/11984) [`5db1659`](https://github.com/apollographql/apollo-client/commit/5db1659dc07e3de697894fc1c6f00a151d068291) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where multiple fetches with results that returned errors would sometimes set the `data` property with an `errorPolicy` of `none`.
|
|
8
|
+
|
|
9
|
+
- [#11974](https://github.com/apollographql/apollo-client/pull/11974) [`c95848e`](https://github.com/apollographql/apollo-client/commit/c95848e859fb7ce0b3b9439ac71dff880f991450) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where `fetchMore` would write its result data to the cache when using it with a `no-cache` fetch policy.
|
|
10
|
+
|
|
11
|
+
- [#11974](https://github.com/apollographql/apollo-client/pull/11974) [`c95848e`](https://github.com/apollographql/apollo-client/commit/c95848e859fb7ce0b3b9439ac71dff880f991450) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where executing `fetchMore` with a `no-cache` fetch policy could sometimes result in multiple network requests.
|
|
12
|
+
|
|
13
|
+
- [#11974](https://github.com/apollographql/apollo-client/pull/11974) [`c95848e`](https://github.com/apollographql/apollo-client/commit/c95848e859fb7ce0b3b9439ac71dff880f991450) Thanks [@jerelmiller](https://github.com/jerelmiller)! -
|
|
14
|
+
|
|
15
|
+
#### Potentially disruptive change
|
|
16
|
+
|
|
17
|
+
When calling `fetchMore` with a query that has a `no-cache` fetch policy, `fetchMore` will now throw if an `updateQuery` function is not provided. This provides a mechanism to merge the results from the `fetchMore` call with the query's previous result.
|
|
18
|
+
|
|
19
|
+
## 3.11.2
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#11980](https://github.com/apollographql/apollo-client/pull/11980) [`38c0a2c`](https://github.com/apollographql/apollo-client/commit/38c0a2c43dd28677ee240754cd389c8a08c05738) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix missing `getServerSnapshot` error when using `useSubscription` on the server.
|
|
24
|
+
|
|
3
25
|
## 3.11.1
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/apollo-client.cjs
CHANGED
|
@@ -31,7 +31,7 @@ function _interopNamespace(e) {
|
|
|
31
31
|
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
32
32
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
33
33
|
|
|
34
|
-
var version = "3.11.
|
|
34
|
+
var version = "3.11.3";
|
|
35
35
|
|
|
36
36
|
function maybe(thunk) {
|
|
37
37
|
try {
|
|
@@ -145,7 +145,7 @@ function shouldInclude(_a, variables) {
|
|
|
145
145
|
if (ifArgument.value.kind === "Variable") {
|
|
146
146
|
evaledValue =
|
|
147
147
|
variables && variables[ifArgument.value.name.value];
|
|
148
|
-
invariant(evaledValue !== void 0,
|
|
148
|
+
invariant(evaledValue !== void 0, 70, directive.name.value);
|
|
149
149
|
}
|
|
150
150
|
else {
|
|
151
151
|
evaledValue = ifArgument.value.value;
|
|
@@ -180,12 +180,12 @@ function getInclusionDirectives(directives) {
|
|
|
180
180
|
return;
|
|
181
181
|
var directiveArguments = directive.arguments;
|
|
182
182
|
var directiveName = directive.name.value;
|
|
183
|
-
invariant(directiveArguments && directiveArguments.length === 1,
|
|
183
|
+
invariant(directiveArguments && directiveArguments.length === 1, 71, directiveName);
|
|
184
184
|
var ifArgument = directiveArguments[0];
|
|
185
|
-
invariant(ifArgument.name && ifArgument.name.value === "if",
|
|
185
|
+
invariant(ifArgument.name && ifArgument.name.value === "if", 72, directiveName);
|
|
186
186
|
var ifValue = ifArgument.value;
|
|
187
187
|
invariant(ifValue &&
|
|
188
|
-
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"),
|
|
188
|
+
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 73, directiveName);
|
|
189
189
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
190
190
|
});
|
|
191
191
|
}
|
|
@@ -213,7 +213,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
213
213
|
document.definitions.forEach(function (definition) {
|
|
214
214
|
if (definition.kind === "OperationDefinition") {
|
|
215
215
|
throw newInvariantError(
|
|
216
|
-
|
|
216
|
+
74,
|
|
217
217
|
definition.operation,
|
|
218
218
|
definition.name ? " named '".concat(definition.name.value, "'") : ""
|
|
219
219
|
);
|
|
@@ -223,7 +223,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
223
223
|
}
|
|
224
224
|
});
|
|
225
225
|
if (typeof actualFragmentName === "undefined") {
|
|
226
|
-
invariant(fragments.length === 1,
|
|
226
|
+
invariant(fragments.length === 1, 75, fragments.length);
|
|
227
227
|
actualFragmentName = fragments[0].name.value;
|
|
228
228
|
}
|
|
229
229
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -264,7 +264,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
264
264
|
return fragmentMap(fragmentName);
|
|
265
265
|
}
|
|
266
266
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
267
|
-
invariant(fragment,
|
|
267
|
+
invariant(fragment, 76, fragmentName);
|
|
268
268
|
return fragment || null;
|
|
269
269
|
}
|
|
270
270
|
default:
|
|
@@ -515,7 +515,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
515
515
|
argObj[name.value] = null;
|
|
516
516
|
}
|
|
517
517
|
else {
|
|
518
|
-
throw newInvariantError(
|
|
518
|
+
throw newInvariantError(85, name.value, value.kind);
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
521
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -649,16 +649,16 @@ function isInlineFragment(selection) {
|
|
|
649
649
|
}
|
|
650
650
|
|
|
651
651
|
function checkDocument(doc) {
|
|
652
|
-
invariant(doc && doc.kind === "Document",
|
|
652
|
+
invariant(doc && doc.kind === "Document", 77);
|
|
653
653
|
var operations = doc.definitions
|
|
654
654
|
.filter(function (d) { return d.kind !== "FragmentDefinition"; })
|
|
655
655
|
.map(function (definition) {
|
|
656
656
|
if (definition.kind !== "OperationDefinition") {
|
|
657
|
-
throw newInvariantError(
|
|
657
|
+
throw newInvariantError(78, definition.kind);
|
|
658
658
|
}
|
|
659
659
|
return definition;
|
|
660
660
|
});
|
|
661
|
-
invariant(operations.length <= 1,
|
|
661
|
+
invariant(operations.length <= 1, 79, operations.length);
|
|
662
662
|
return doc;
|
|
663
663
|
}
|
|
664
664
|
function getOperationDefinition(doc) {
|
|
@@ -681,14 +681,14 @@ function getFragmentDefinitions(doc) {
|
|
|
681
681
|
}
|
|
682
682
|
function getQueryDefinition(doc) {
|
|
683
683
|
var queryDef = getOperationDefinition(doc);
|
|
684
|
-
invariant(queryDef && queryDef.operation === "query",
|
|
684
|
+
invariant(queryDef && queryDef.operation === "query", 80);
|
|
685
685
|
return queryDef;
|
|
686
686
|
}
|
|
687
687
|
function getFragmentDefinition(doc) {
|
|
688
|
-
invariant(doc.kind === "Document",
|
|
689
|
-
invariant(doc.definitions.length <= 1,
|
|
688
|
+
invariant(doc.kind === "Document", 81);
|
|
689
|
+
invariant(doc.definitions.length <= 1, 82);
|
|
690
690
|
var fragmentDef = doc.definitions[0];
|
|
691
|
-
invariant(fragmentDef.kind === "FragmentDefinition",
|
|
691
|
+
invariant(fragmentDef.kind === "FragmentDefinition", 83);
|
|
692
692
|
return fragmentDef;
|
|
693
693
|
}
|
|
694
694
|
function getMainDefinition(queryDoc) {
|
|
@@ -711,7 +711,7 @@ function getMainDefinition(queryDoc) {
|
|
|
711
711
|
if (fragmentDefinition) {
|
|
712
712
|
return fragmentDefinition;
|
|
713
713
|
}
|
|
714
|
-
throw newInvariantError(
|
|
714
|
+
throw newInvariantError(84);
|
|
715
715
|
}
|
|
716
716
|
function getDefaultValues(definition) {
|
|
717
717
|
var defaultValues = Object.create(null);
|
|
@@ -762,7 +762,7 @@ var DocumentTransform = (function () {
|
|
|
762
762
|
makeCacheKey: function (document) {
|
|
763
763
|
var cacheKeys = _this.getCacheKey(document);
|
|
764
764
|
if (cacheKeys) {
|
|
765
|
-
invariant(Array.isArray(cacheKeys),
|
|
765
|
+
invariant(Array.isArray(cacheKeys), 69);
|
|
766
766
|
return stableCacheKeys_1.lookupArray(cacheKeys);
|
|
767
767
|
}
|
|
768
768
|
},
|
|
@@ -892,7 +892,7 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
892
892
|
return getInUseByFragmentName(ancestor.name.value);
|
|
893
893
|
}
|
|
894
894
|
}
|
|
895
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
895
|
+
globalThis.__DEV__ !== false && invariant.error(86);
|
|
896
896
|
return null;
|
|
897
897
|
};
|
|
898
898
|
var operationCount = 0;
|
|
@@ -1546,7 +1546,7 @@ function toPromise(observable) {
|
|
|
1546
1546
|
observable.subscribe({
|
|
1547
1547
|
next: function (data) {
|
|
1548
1548
|
if (completed) {
|
|
1549
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
1549
|
+
globalThis.__DEV__ !== false && invariant.warn(43);
|
|
1550
1550
|
}
|
|
1551
1551
|
else {
|
|
1552
1552
|
completed = true;
|
|
@@ -1589,7 +1589,7 @@ function validateOperation(operation) {
|
|
|
1589
1589
|
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
|
|
1590
1590
|
var key = _a[_i];
|
|
1591
1591
|
if (OPERATION_FIELDS.indexOf(key) < 0) {
|
|
1592
|
-
throw newInvariantError(
|
|
1592
|
+
throw newInvariantError(44, key);
|
|
1593
1593
|
}
|
|
1594
1594
|
}
|
|
1595
1595
|
return operation;
|
|
@@ -1698,7 +1698,7 @@ var ApolloLink = (function () {
|
|
|
1698
1698
|
ApolloLink.concat = function (first, second) {
|
|
1699
1699
|
var firstLink = toLink(first);
|
|
1700
1700
|
if (isTerminating(firstLink)) {
|
|
1701
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
1701
|
+
globalThis.__DEV__ !== false && invariant.warn(36, firstLink);
|
|
1702
1702
|
return firstLink;
|
|
1703
1703
|
}
|
|
1704
1704
|
var nextLink = toLink(second);
|
|
@@ -1724,7 +1724,7 @@ var ApolloLink = (function () {
|
|
|
1724
1724
|
return ApolloLink.concat(this, next);
|
|
1725
1725
|
};
|
|
1726
1726
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
1727
|
-
throw newInvariantError(
|
|
1727
|
+
throw newInvariantError(37);
|
|
1728
1728
|
};
|
|
1729
1729
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
1730
1730
|
if (observer && observer.error) {
|
|
@@ -2106,7 +2106,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
2106
2106
|
serialized = JSON.stringify(p);
|
|
2107
2107
|
}
|
|
2108
2108
|
catch (e) {
|
|
2109
|
-
var parseError = newInvariantError(
|
|
2109
|
+
var parseError = newInvariantError(40, label, e.message);
|
|
2110
2110
|
parseError.parseError = e;
|
|
2111
2111
|
throw parseError;
|
|
2112
2112
|
}
|
|
@@ -2192,7 +2192,7 @@ function removeDuplicateHeaders(headers, preserveHeaderCase) {
|
|
|
2192
2192
|
|
|
2193
2193
|
var checkFetcher = function (fetcher) {
|
|
2194
2194
|
if (!fetcher && typeof fetch === "undefined") {
|
|
2195
|
-
throw newInvariantError(
|
|
2195
|
+
throw newInvariantError(38);
|
|
2196
2196
|
}
|
|
2197
2197
|
};
|
|
2198
2198
|
|
|
@@ -2326,7 +2326,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
2326
2326
|
options.headers = options.headers || {};
|
|
2327
2327
|
var acceptHeader = "multipart/mixed;";
|
|
2328
2328
|
if (isSubscription && hasDefer) {
|
|
2329
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
2329
|
+
globalThis.__DEV__ !== false && invariant.warn(39);
|
|
2330
2330
|
}
|
|
2331
2331
|
if (isSubscription) {
|
|
2332
2332
|
acceptHeader +=
|
|
@@ -5095,6 +5095,11 @@ var ObservableQuery = (function (_super) {
|
|
|
5095
5095
|
this.observe();
|
|
5096
5096
|
}
|
|
5097
5097
|
var updatedQuerySet = new Set();
|
|
5098
|
+
var updateQuery = fetchMoreOptions === null || fetchMoreOptions === void 0 ? void 0 : fetchMoreOptions.updateQuery;
|
|
5099
|
+
var isCached = this.options.fetchPolicy !== "no-cache";
|
|
5100
|
+
if (!isCached) {
|
|
5101
|
+
invariant(updateQuery, 21);
|
|
5102
|
+
}
|
|
5098
5103
|
return this.queryManager
|
|
5099
5104
|
.fetchQuery(qid, combinedOptions, exports.NetworkStatus.fetchMore)
|
|
5100
5105
|
.then(function (fetchMoreResult) {
|
|
@@ -5102,38 +5107,48 @@ var ObservableQuery = (function (_super) {
|
|
|
5102
5107
|
if (queryInfo.networkStatus === exports.NetworkStatus.fetchMore) {
|
|
5103
5108
|
queryInfo.networkStatus = originalNetworkStatus;
|
|
5104
5109
|
}
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5110
|
+
if (isCached) {
|
|
5111
|
+
_this.queryManager.cache.batch({
|
|
5112
|
+
update: function (cache) {
|
|
5113
|
+
var updateQuery = fetchMoreOptions.updateQuery;
|
|
5114
|
+
if (updateQuery) {
|
|
5115
|
+
cache.updateQuery({
|
|
5116
|
+
query: _this.query,
|
|
5117
|
+
variables: _this.variables,
|
|
5118
|
+
returnPartialData: true,
|
|
5119
|
+
optimistic: false,
|
|
5120
|
+
}, function (previous) {
|
|
5121
|
+
return updateQuery(previous, {
|
|
5122
|
+
fetchMoreResult: fetchMoreResult.data,
|
|
5123
|
+
variables: combinedOptions.variables,
|
|
5124
|
+
});
|
|
5125
|
+
});
|
|
5126
|
+
}
|
|
5127
|
+
else {
|
|
5128
|
+
cache.writeQuery({
|
|
5129
|
+
query: combinedOptions.query,
|
|
5117
5130
|
variables: combinedOptions.variables,
|
|
5131
|
+
data: fetchMoreResult.data,
|
|
5118
5132
|
});
|
|
5119
|
-
}
|
|
5120
|
-
}
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
}
|
|
5132
|
-
|
|
5133
|
+
}
|
|
5134
|
+
},
|
|
5135
|
+
onWatchUpdated: function (watch) {
|
|
5136
|
+
updatedQuerySet.add(watch.query);
|
|
5137
|
+
},
|
|
5138
|
+
});
|
|
5139
|
+
}
|
|
5140
|
+
else {
|
|
5141
|
+
var lastResult = _this.getLast("result");
|
|
5142
|
+
var data = updateQuery(lastResult.data, {
|
|
5143
|
+
fetchMoreResult: fetchMoreResult.data,
|
|
5144
|
+
variables: combinedOptions.variables,
|
|
5145
|
+
});
|
|
5146
|
+
_this.reportResult(tslib.__assign(tslib.__assign({}, lastResult), { data: data }), _this.variables);
|
|
5147
|
+
}
|
|
5133
5148
|
return fetchMoreResult;
|
|
5134
5149
|
})
|
|
5135
5150
|
.finally(function () {
|
|
5136
|
-
if (!updatedQuerySet.has(_this.query)) {
|
|
5151
|
+
if (isCached && !updatedQuerySet.has(_this.query)) {
|
|
5137
5152
|
reobserveCacheFirst(_this);
|
|
5138
5153
|
}
|
|
5139
5154
|
});
|
|
@@ -5164,7 +5179,7 @@ var ObservableQuery = (function (_super) {
|
|
|
5164
5179
|
options.onError(err);
|
|
5165
5180
|
return;
|
|
5166
5181
|
}
|
|
5167
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
5182
|
+
globalThis.__DEV__ !== false && invariant.error(22, err);
|
|
5168
5183
|
},
|
|
5169
5184
|
});
|
|
5170
5185
|
this.subscriptions.add(subscription);
|
|
@@ -5264,7 +5279,7 @@ var ObservableQuery = (function (_super) {
|
|
|
5264
5279
|
if (pollingInfo && pollingInfo.interval === pollInterval) {
|
|
5265
5280
|
return;
|
|
5266
5281
|
}
|
|
5267
|
-
invariant(pollInterval,
|
|
5282
|
+
invariant(pollInterval, 23);
|
|
5268
5283
|
var info = pollingInfo || (this.pollingInfo = {});
|
|
5269
5284
|
info.interval = pollInterval;
|
|
5270
5285
|
var maybeFetch = function () {
|
|
@@ -5438,11 +5453,11 @@ function reobserveCacheFirst(obsQuery) {
|
|
|
5438
5453
|
return obsQuery.reobserve();
|
|
5439
5454
|
}
|
|
5440
5455
|
function defaultSubscriptionObserverErrorCallback(error) {
|
|
5441
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
5456
|
+
globalThis.__DEV__ !== false && invariant.error(24, error.message, error.stack);
|
|
5442
5457
|
}
|
|
5443
5458
|
function logMissingFieldErrors(missing) {
|
|
5444
5459
|
if (globalThis.__DEV__ !== false && missing) {
|
|
5445
|
-
globalThis.__DEV__ !== false && invariant.debug(
|
|
5460
|
+
globalThis.__DEV__ !== false && invariant.debug(25, missing);
|
|
5446
5461
|
}
|
|
5447
5462
|
}
|
|
5448
5463
|
function skipCacheDataFor(fetchPolicy ) {
|
|
@@ -5770,7 +5785,7 @@ var QueryManager = (function () {
|
|
|
5770
5785
|
this.queries.forEach(function (_info, queryId) {
|
|
5771
5786
|
_this.stopQueryNoBroadcast(queryId);
|
|
5772
5787
|
});
|
|
5773
|
-
this.cancelPendingFetches(newInvariantError(
|
|
5788
|
+
this.cancelPendingFetches(newInvariantError(26));
|
|
5774
5789
|
};
|
|
5775
5790
|
QueryManager.prototype.cancelPendingFetches = function (error) {
|
|
5776
5791
|
this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
|
|
@@ -5784,8 +5799,8 @@ var QueryManager = (function () {
|
|
|
5784
5799
|
return tslib.__generator(this, function (_j) {
|
|
5785
5800
|
switch (_j.label) {
|
|
5786
5801
|
case 0:
|
|
5787
|
-
invariant(mutation,
|
|
5788
|
-
invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache",
|
|
5802
|
+
invariant(mutation, 27);
|
|
5803
|
+
invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 28);
|
|
5789
5804
|
mutationId = this.generateMutationId();
|
|
5790
5805
|
mutation = this.cache.transformForLink(this.transform(mutation));
|
|
5791
5806
|
hasClientExports = this.getDocumentInfo(mutation).hasClientExports;
|
|
@@ -6107,10 +6122,10 @@ var QueryManager = (function () {
|
|
|
6107
6122
|
QueryManager.prototype.query = function (options, queryId) {
|
|
6108
6123
|
var _this = this;
|
|
6109
6124
|
if (queryId === void 0) { queryId = this.generateQueryId(); }
|
|
6110
|
-
invariant(options.query,
|
|
6111
|
-
invariant(options.query.kind === "Document",
|
|
6112
|
-
invariant(!options.returnPartialData,
|
|
6113
|
-
invariant(!options.pollInterval,
|
|
6125
|
+
invariant(options.query, 29);
|
|
6126
|
+
invariant(options.query.kind === "Document", 30);
|
|
6127
|
+
invariant(!options.returnPartialData, 31);
|
|
6128
|
+
invariant(!options.pollInterval, 32);
|
|
6114
6129
|
return this.fetchQuery(queryId, tslib.__assign(tslib.__assign({}, options), { query: this.transform(options.query) })).finally(function () { return _this.stopQuery(queryId); });
|
|
6115
6130
|
};
|
|
6116
6131
|
QueryManager.prototype.generateQueryId = function () {
|
|
@@ -6135,7 +6150,7 @@ var QueryManager = (function () {
|
|
|
6135
6150
|
if (options === void 0) { options = {
|
|
6136
6151
|
discardWatches: true,
|
|
6137
6152
|
}; }
|
|
6138
|
-
this.cancelPendingFetches(newInvariantError(
|
|
6153
|
+
this.cancelPendingFetches(newInvariantError(33));
|
|
6139
6154
|
this.queries.forEach(function (queryInfo) {
|
|
6140
6155
|
if (queryInfo.observableQuery) {
|
|
6141
6156
|
queryInfo.networkStatus = exports.NetworkStatus.loading;
|
|
@@ -6211,7 +6226,7 @@ var QueryManager = (function () {
|
|
|
6211
6226
|
if (globalThis.__DEV__ !== false && queryNamesAndDocs.size) {
|
|
6212
6227
|
queryNamesAndDocs.forEach(function (included, nameOrDoc) {
|
|
6213
6228
|
if (!included) {
|
|
6214
|
-
globalThis.__DEV__ !== false && invariant.warn(typeof nameOrDoc === "string" ?
|
|
6229
|
+
globalThis.__DEV__ !== false && invariant.warn(typeof nameOrDoc === "string" ? 34 : 35, nameOrDoc);
|
|
6215
6230
|
}
|
|
6216
6231
|
});
|
|
6217
6232
|
}
|
|
@@ -6369,8 +6384,9 @@ var QueryManager = (function () {
|
|
|
6369
6384
|
return asyncMap(this.getObservableFromLink(linkDocument, options.context, options.variables), function (result) {
|
|
6370
6385
|
var graphQLErrors = getGraphQLErrorsFromResult(result);
|
|
6371
6386
|
var hasErrors = graphQLErrors.length > 0;
|
|
6387
|
+
var errorPolicy = options.errorPolicy;
|
|
6372
6388
|
if (requestId >= queryInfo.lastRequestId) {
|
|
6373
|
-
if (hasErrors &&
|
|
6389
|
+
if (hasErrors && errorPolicy === "none") {
|
|
6374
6390
|
throw queryInfo.markError(new ApolloError({
|
|
6375
6391
|
graphQLErrors: graphQLErrors,
|
|
6376
6392
|
}));
|
|
@@ -6383,7 +6399,10 @@ var QueryManager = (function () {
|
|
|
6383
6399
|
loading: false,
|
|
6384
6400
|
networkStatus: exports.NetworkStatus.ready,
|
|
6385
6401
|
};
|
|
6386
|
-
if (hasErrors &&
|
|
6402
|
+
if (hasErrors && errorPolicy === "none") {
|
|
6403
|
+
aqr.data = void 0;
|
|
6404
|
+
}
|
|
6405
|
+
if (hasErrors && errorPolicy !== "ignore") {
|
|
6387
6406
|
aqr.errors = graphQLErrors;
|
|
6388
6407
|
aqr.networkStatus = exports.NetworkStatus.error;
|
|
6389
6408
|
}
|
|
@@ -7231,7 +7250,7 @@ if (globalThis.__DEV__ !== false) {
|
|
|
7231
7250
|
|
|
7232
7251
|
var contextKey = canUseSymbol ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__";
|
|
7233
7252
|
function getApolloContext() {
|
|
7234
|
-
invariant("createContext" in React__namespace,
|
|
7253
|
+
invariant("createContext" in React__namespace, 46);
|
|
7235
7254
|
var context = React__namespace.createContext[contextKey];
|
|
7236
7255
|
if (!context) {
|
|
7237
7256
|
Object.defineProperty(React__namespace.createContext, contextKey, {
|
|
@@ -7249,7 +7268,7 @@ var resetApolloContext = getApolloContext;
|
|
|
7249
7268
|
var ApolloConsumer = function (props) {
|
|
7250
7269
|
var ApolloContext = getApolloContext();
|
|
7251
7270
|
return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
|
|
7252
|
-
invariant(context && context.client,
|
|
7271
|
+
invariant(context && context.client, 45);
|
|
7253
7272
|
return props.children(context.client);
|
|
7254
7273
|
}));
|
|
7255
7274
|
};
|
|
@@ -7261,14 +7280,14 @@ var ApolloProvider = function (_a) {
|
|
|
7261
7280
|
var context = React__namespace.useMemo(function () {
|
|
7262
7281
|
return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client });
|
|
7263
7282
|
}, [parentContext, client]);
|
|
7264
|
-
invariant(context.client,
|
|
7283
|
+
invariant(context.client, 47);
|
|
7265
7284
|
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
7266
7285
|
};
|
|
7267
7286
|
|
|
7268
7287
|
function useApolloClient(override) {
|
|
7269
7288
|
var context = React__namespace.useContext(getApolloContext());
|
|
7270
7289
|
var client = override || context.client;
|
|
7271
|
-
invariant(!!client,
|
|
7290
|
+
invariant(!!client, 50);
|
|
7272
7291
|
return client;
|
|
7273
7292
|
}
|
|
7274
7293
|
|
|
@@ -7283,7 +7302,7 @@ var useSyncExternalStore = realHook$1 ||
|
|
|
7283
7302
|
!didWarnUncachedGetSnapshot &&
|
|
7284
7303
|
value !== getSnapshot()) {
|
|
7285
7304
|
didWarnUncachedGetSnapshot = true;
|
|
7286
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
7305
|
+
globalThis.__DEV__ !== false && invariant.error(60);
|
|
7287
7306
|
}
|
|
7288
7307
|
var _a = React__namespace.useState({
|
|
7289
7308
|
inst: { value: value, getSnapshot: getSnapshot },
|
|
@@ -7351,7 +7370,7 @@ function parser(document) {
|
|
|
7351
7370
|
if (cached)
|
|
7352
7371
|
return cached;
|
|
7353
7372
|
var variables, type, name;
|
|
7354
|
-
invariant(!!document && !!document.kind,
|
|
7373
|
+
invariant(!!document && !!document.kind, 62, document);
|
|
7355
7374
|
var fragments = [];
|
|
7356
7375
|
var queries = [];
|
|
7357
7376
|
var mutations = [];
|
|
@@ -7379,10 +7398,10 @@ function parser(document) {
|
|
|
7379
7398
|
invariant(!fragments.length ||
|
|
7380
7399
|
queries.length ||
|
|
7381
7400
|
mutations.length ||
|
|
7382
|
-
subscriptions.length,
|
|
7401
|
+
subscriptions.length, 63);
|
|
7383
7402
|
invariant(
|
|
7384
7403
|
queries.length + mutations.length + subscriptions.length <= 1,
|
|
7385
|
-
|
|
7404
|
+
64,
|
|
7386
7405
|
document,
|
|
7387
7406
|
queries.length,
|
|
7388
7407
|
subscriptions.length,
|
|
@@ -7394,7 +7413,7 @@ function parser(document) {
|
|
|
7394
7413
|
var definitions = queries.length ? queries
|
|
7395
7414
|
: mutations.length ? mutations
|
|
7396
7415
|
: subscriptions;
|
|
7397
|
-
invariant(definitions.length === 1,
|
|
7416
|
+
invariant(definitions.length === 1, 65, document, definitions.length);
|
|
7398
7417
|
var definition = definitions[0];
|
|
7399
7418
|
variables = definition.variableDefinitions || [];
|
|
7400
7419
|
if (definition.name && definition.name.kind === "Name") {
|
|
@@ -7419,7 +7438,7 @@ function verifyDocumentType(document, type) {
|
|
|
7419
7438
|
var usedOperationName = operationName(operation.type);
|
|
7420
7439
|
invariant(
|
|
7421
7440
|
operation.type === type,
|
|
7422
|
-
|
|
7441
|
+
66,
|
|
7423
7442
|
requiredOperationName,
|
|
7424
7443
|
requiredOperationName,
|
|
7425
7444
|
usedOperationName
|
|
@@ -8000,10 +8019,10 @@ function useSubscription(subscription, options) {
|
|
|
8000
8019
|
if (!hasIssuedDeprecationWarningRef.current) {
|
|
8001
8020
|
hasIssuedDeprecationWarningRef.current = true;
|
|
8002
8021
|
if (options.onSubscriptionData) {
|
|
8003
|
-
globalThis.__DEV__ !== false && invariant.warn(options.onData ?
|
|
8022
|
+
globalThis.__DEV__ !== false && invariant.warn(options.onData ? 53 : 54);
|
|
8004
8023
|
}
|
|
8005
8024
|
if (options.onSubscriptionComplete) {
|
|
8006
|
-
globalThis.__DEV__ !== false && invariant.warn(options.onComplete ?
|
|
8025
|
+
globalThis.__DEV__ !== false && invariant.warn(options.onComplete ? 55 : 56);
|
|
8007
8026
|
}
|
|
8008
8027
|
}
|
|
8009
8028
|
var skip = options.skip, fetchPolicy = options.fetchPolicy, errorPolicy = options.errorPolicy, shouldResubscribe = options.shouldResubscribe, context = options.context, extensions = options.extensions, ignoreResults = options.ignoreResults;
|
|
@@ -8122,9 +8141,9 @@ function useSubscription(subscription, options) {
|
|
|
8122
8141
|
return observable && !skip && !ignoreResults ?
|
|
8123
8142
|
observable.__.result
|
|
8124
8143
|
: fallbackResult;
|
|
8125
|
-
});
|
|
8144
|
+
}, function () { return fallbackResult; });
|
|
8126
8145
|
return React__namespace.useMemo(function () { return (tslib.__assign(tslib.__assign({}, ret), { restart: function () {
|
|
8127
|
-
invariant(!optionsRef.current.skip,
|
|
8146
|
+
invariant(!optionsRef.current.skip, 57);
|
|
8128
8147
|
setObservable(recreateRef.current());
|
|
8129
8148
|
} })); }, [ret]);
|
|
8130
8149
|
}
|
|
@@ -8226,7 +8245,7 @@ function wrapQueryRef(internalQueryRef) {
|
|
|
8226
8245
|
return ref;
|
|
8227
8246
|
}
|
|
8228
8247
|
function assertWrappedQueryRef(queryRef) {
|
|
8229
|
-
invariant(!queryRef || QUERY_REFERENCE_SYMBOL in queryRef,
|
|
8248
|
+
invariant(!queryRef || QUERY_REFERENCE_SYMBOL in queryRef, 61);
|
|
8230
8249
|
}
|
|
8231
8250
|
function getWrappedPromise(queryRef) {
|
|
8232
8251
|
var internalQueryRef = unwrapQueryRef(queryRef);
|
|
@@ -8597,11 +8616,11 @@ function validateFetchPolicy(fetchPolicy) {
|
|
|
8597
8616
|
"no-cache",
|
|
8598
8617
|
"cache-and-network",
|
|
8599
8618
|
];
|
|
8600
|
-
invariant(supportedFetchPolicies.includes(fetchPolicy),
|
|
8619
|
+
invariant(supportedFetchPolicies.includes(fetchPolicy), 58, fetchPolicy);
|
|
8601
8620
|
}
|
|
8602
8621
|
function validatePartialDataReturn(fetchPolicy, returnPartialData) {
|
|
8603
8622
|
if (fetchPolicy === "no-cache" && returnPartialData) {
|
|
8604
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
8623
|
+
globalThis.__DEV__ !== false && invariant.warn(59);
|
|
8605
8624
|
}
|
|
8606
8625
|
}
|
|
8607
8626
|
function toApolloError(result) {
|
|
@@ -8721,7 +8740,7 @@ function useLoadableQuery(query, options) {
|
|
|
8721
8740
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
8722
8741
|
args[_i] = arguments[_i];
|
|
8723
8742
|
}
|
|
8724
|
-
invariant(!calledDuringRender(),
|
|
8743
|
+
invariant(!calledDuringRender(), 51);
|
|
8725
8744
|
var variables = args[0];
|
|
8726
8745
|
var cacheKey = tslib.__spreadArray([
|
|
8727
8746
|
query,
|
|
@@ -8740,7 +8759,7 @@ function useLoadableQuery(query, options) {
|
|
|
8740
8759
|
client,
|
|
8741
8760
|
]);
|
|
8742
8761
|
var subscribeToMore = React__namespace.useCallback(function (options) {
|
|
8743
|
-
invariant(internalQueryRef,
|
|
8762
|
+
invariant(internalQueryRef, 52);
|
|
8744
8763
|
return internalQueryRef.observable.subscribeToMore(options);
|
|
8745
8764
|
}, [internalQueryRef]);
|
|
8746
8765
|
var reset = React__namespace.useCallback(function () {
|