@apollo/client 3.9.6 → 3.9.8
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 +20 -0
- package/apollo-client.cjs +41 -34
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/core/ApolloClient.d.ts +7 -7
- package/core/ApolloClient.js +6 -6
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +13 -13
- package/core/LocalState.js.map +1 -1
- package/core/QueryManager.js +7 -7
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +21 -21
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +21 -21
- package/core/watchQueryOptions.d.ts +3 -3
- package/dev/dev.cjs +18 -15
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +18 -15
- package/dev/index.d.ts +2 -0
- package/dev/index.js +1 -0
- package/dev/index.js.map +1 -1
- package/dev/loadErrorMessageHandler.d.ts +6 -1
- package/dev/loadErrorMessageHandler.js +17 -14
- package/dev/loadErrorMessageHandler.js.map +1 -1
- package/dev/setErrorMessageHandler.d.ts +34 -0
- package/dev/setErrorMessageHandler.js +9 -0
- package/dev/setErrorMessageHandler.js.map +1 -0
- package/link/http/http.cjs +11 -8
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +11 -8
- package/link/http/parseAndCheckHttpResponse.js +11 -8
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/package.json +24 -24
- package/react/hooks/hooks.cjs +4 -1
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +4 -1
- package/react/hooks/internal/useRenderGuard.js +1 -1
- package/react/hooks/internal/useRenderGuard.js.map +1 -1
- package/react/hooks/useFragment.d.ts +1 -1
- package/react/hooks/useFragment.js +5 -0
- package/react/hooks/useFragment.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +2 -2
- package/react/internal/cache/QueryReference.js +13 -4
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/internal.cjs +5 -4
- package/react/internal/internal.cjs.map +1 -1
- package/react/internal/internal.cjs.native.js +5 -4
- package/react/query-preloader/createQueryPreloader.d.ts +6 -6
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/types/types.d.ts +3 -3
- package/react/types/types.documentation.d.ts +4 -4
- package/react/types/types.documentation.js.map +1 -1
- package/testing/internal/ObservableStream.js +3 -3
- package/testing/internal/ObservableStream.js.map +1 -1
- package/testing/internal/profile/profile.js +6 -6
- package/testing/internal/profile/profile.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/globals/invariantWrappers.d.ts +1 -1
- package/utilities/globals/invariantWrappers.js.map +1 -1
- package/utilities/subscriptions/relay/relay.cjs +11 -8
- package/utilities/subscriptions/relay/relay.cjs.map +1 -1
- package/utilities/subscriptions/relay/relay.cjs.native.js +11 -8
- package/utilities/subscriptions/urql/urql.cjs +11 -8
- package/utilities/subscriptions/urql/urql.cjs.map +1 -1
- package/utilities/subscriptions/urql/urql.cjs.native.js +11 -8
- package/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @apollo/client
|
|
2
2
|
|
|
3
|
+
## 3.9.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#11706](https://github.com/apollographql/apollo-client/pull/11706) [`8619bc7`](https://github.com/apollographql/apollo-client/commit/8619bc7e569c1c732afa6faf605c83a6ce0cdf0c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue in all suspense hooks where returning an empty array after calling `fetchMore` would rerender the component with an empty list.
|
|
8
|
+
|
|
9
|
+
- [#11694](https://github.com/apollographql/apollo-client/pull/11694) [`835d5f3`](https://github.com/apollographql/apollo-client/commit/835d5f30c532c432e2434561580e6f1ec44cc908) Thanks [@phryneas](https://github.com/phryneas)! - Expose `setErrorMessageHandler` from `@apollo/client/dev` entrypoint.
|
|
10
|
+
|
|
11
|
+
- [#11689](https://github.com/apollographql/apollo-client/pull/11689) [`cb8ffe5`](https://github.com/apollographql/apollo-client/commit/cb8ffe50e903397f741b62a44624bfe69b5f7b75) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue where passing a new `from` option to `useFragment` would first render with the previous value before rerendering with the correct value.
|
|
12
|
+
|
|
13
|
+
- [#11713](https://github.com/apollographql/apollo-client/pull/11713) [`642092c`](https://github.com/apollographql/apollo-client/commit/642092c713199093aede45f105a1ee3f637614cd) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue where setting a default `watchQuery` option in the `ApolloClient` constructor could break `startTransition` when used with suspense hooks.
|
|
14
|
+
|
|
15
|
+
## 3.9.7
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#11659](https://github.com/apollographql/apollo-client/pull/11659) [`652a61e`](https://github.com/apollographql/apollo-client/commit/652a61e96db0f0e27d0a22fafae1df388f3fdf36) Thanks [@phryneas](https://github.com/phryneas)! - Make `useRenderGuard` more resilient to changes in React internals.
|
|
20
|
+
|
|
21
|
+
- [#11594](https://github.com/apollographql/apollo-client/pull/11594) [`50b1097`](https://github.com/apollographql/apollo-client/commit/50b10970ca0efa290ae415ef801650327a89ab8e) Thanks [@alessbell](https://github.com/alessbell)! - Adds a fix for multipart subscriptions that terminate with payload: null
|
|
22
|
+
|
|
3
23
|
## 3.9.6
|
|
4
24
|
|
|
5
25
|
### 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.9.
|
|
34
|
+
var version = "3.9.8";
|
|
35
35
|
|
|
36
36
|
function maybe(thunk) {
|
|
37
37
|
try {
|
|
@@ -1938,10 +1938,10 @@ var ApolloError = (function (_super) {
|
|
|
1938
1938
|
|
|
1939
1939
|
var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
1940
1940
|
function readMultipartBody(response, nextValue) {
|
|
1941
|
-
var _a;
|
|
1942
1941
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1943
|
-
var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running,
|
|
1944
|
-
var
|
|
1942
|
+
var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _a, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next;
|
|
1943
|
+
var _b, _c;
|
|
1944
|
+
var _d;
|
|
1945
1945
|
return tslib.__generator(this, function (_e) {
|
|
1946
1946
|
switch (_e.label) {
|
|
1947
1947
|
case 0:
|
|
@@ -1949,7 +1949,7 @@ function readMultipartBody(response, nextValue) {
|
|
|
1949
1949
|
throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");
|
|
1950
1950
|
}
|
|
1951
1951
|
decoder = new TextDecoder("utf-8");
|
|
1952
|
-
contentType = (
|
|
1952
|
+
contentType = (_d = response.headers) === null || _d === void 0 ? void 0 : _d.get("content-type");
|
|
1953
1953
|
delimiter = "boundary=";
|
|
1954
1954
|
boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter)) ?
|
|
1955
1955
|
contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['"]/g, "").replace(/\;(.*)/gm, "").trim()
|
|
@@ -1963,7 +1963,7 @@ function readMultipartBody(response, nextValue) {
|
|
|
1963
1963
|
if (!running) return [3 , 3];
|
|
1964
1964
|
return [4 , iterator.next()];
|
|
1965
1965
|
case 2:
|
|
1966
|
-
|
|
1966
|
+
_a = _e.sent(), value = _a.value, done = _a.done;
|
|
1967
1967
|
chunk = typeof value === "string" ? value : decoder.decode(value);
|
|
1968
1968
|
searchFrom = buffer.length - boundary.length + 1;
|
|
1969
1969
|
running = !done;
|
|
@@ -1971,10 +1971,10 @@ function readMultipartBody(response, nextValue) {
|
|
|
1971
1971
|
bi = buffer.indexOf(boundary, searchFrom);
|
|
1972
1972
|
while (bi > -1) {
|
|
1973
1973
|
message = void 0;
|
|
1974
|
-
|
|
1974
|
+
_b = [
|
|
1975
1975
|
buffer.slice(0, bi),
|
|
1976
1976
|
buffer.slice(bi + boundary.length),
|
|
1977
|
-
], message =
|
|
1977
|
+
], message = _b[0], buffer = _b[1];
|
|
1978
1978
|
i = message.indexOf("\r\n\r\n");
|
|
1979
1979
|
headers = parseHeaders(message.slice(0, i));
|
|
1980
1980
|
contentType_1 = headers["content-type"];
|
|
@@ -1993,10 +1993,13 @@ function readMultipartBody(response, nextValue) {
|
|
|
1993
1993
|
if (isApolloPayloadResult(result)) {
|
|
1994
1994
|
next = {};
|
|
1995
1995
|
if ("payload" in result) {
|
|
1996
|
+
if (Object.keys(result).length === 1 && result.payload === null) {
|
|
1997
|
+
return [2 ];
|
|
1998
|
+
}
|
|
1996
1999
|
next = tslib.__assign({}, result.payload);
|
|
1997
2000
|
}
|
|
1998
2001
|
if ("errors" in result) {
|
|
1999
|
-
next = tslib.__assign(tslib.__assign({}, next), { extensions: tslib.__assign(tslib.__assign({}, ("extensions" in next ? next.extensions : null)), (
|
|
2002
|
+
next = tslib.__assign(tslib.__assign({}, next), { extensions: tslib.__assign(tslib.__assign({}, ("extensions" in next ? next.extensions : null)), (_c = {}, _c[PROTOCOL_ERRORS_SYMBOL] = result.errors, _c)) });
|
|
2000
2003
|
}
|
|
2001
2004
|
nextValue(next);
|
|
2002
2005
|
}
|
|
@@ -5436,9 +5439,9 @@ var LocalState = (function () {
|
|
|
5436
5439
|
return this.resolvers || {};
|
|
5437
5440
|
};
|
|
5438
5441
|
LocalState.prototype.runResolvers = function (_a) {
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
return tslib.__generator(this, function (
|
|
5442
|
+
return tslib.__awaiter(this, arguments, void 0, function (_b) {
|
|
5443
|
+
var document = _b.document, remoteResult = _b.remoteResult, context = _b.context, variables = _b.variables, _c = _b.onlyRunForcedResolvers, onlyRunForcedResolvers = _c === void 0 ? false : _c;
|
|
5444
|
+
return tslib.__generator(this, function (_d) {
|
|
5442
5445
|
if (document) {
|
|
5443
5446
|
return [2 , this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (tslib.__assign(tslib.__assign({}, remoteResult), { data: localResult.result })); })];
|
|
5444
5447
|
}
|
|
@@ -5470,10 +5473,10 @@ var LocalState = (function () {
|
|
|
5470
5473
|
return cache.identify(obj);
|
|
5471
5474
|
} });
|
|
5472
5475
|
};
|
|
5473
|
-
LocalState.prototype.addExportedVariables = function (
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5476
|
+
LocalState.prototype.addExportedVariables = function (document_1) {
|
|
5477
|
+
return tslib.__awaiter(this, arguments, void 0, function (document, variables, context) {
|
|
5478
|
+
if (variables === void 0) { variables = {}; }
|
|
5479
|
+
if (context === void 0) { context = {}; }
|
|
5477
5480
|
return tslib.__generator(this, function (_a) {
|
|
5478
5481
|
if (document) {
|
|
5479
5482
|
return [2 , this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (tslib.__assign(tslib.__assign({}, variables), data.exportedVariables)); })];
|
|
@@ -5510,13 +5513,13 @@ var LocalState = (function () {
|
|
|
5510
5513
|
optimistic: false,
|
|
5511
5514
|
}).result;
|
|
5512
5515
|
};
|
|
5513
|
-
LocalState.prototype.resolveDocument = function (
|
|
5514
|
-
|
|
5515
|
-
if (variables === void 0) { variables = {}; }
|
|
5516
|
-
if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; }
|
|
5517
|
-
if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; }
|
|
5518
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
5516
|
+
LocalState.prototype.resolveDocument = function (document_1, rootValue_1) {
|
|
5517
|
+
return tslib.__awaiter(this, arguments, void 0, function (document, rootValue, context, variables, fragmentMatcher, onlyRunForcedResolvers) {
|
|
5519
5518
|
var mainDefinition, fragments, fragmentMap, selectionsToResolve, definitionOperation, defaultOperationType, _a, cache, client, execContext, isClientFieldDescendant;
|
|
5519
|
+
if (context === void 0) { context = {}; }
|
|
5520
|
+
if (variables === void 0) { variables = {}; }
|
|
5521
|
+
if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; }
|
|
5522
|
+
if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; }
|
|
5520
5523
|
return tslib.__generator(this, function (_b) {
|
|
5521
5524
|
mainDefinition = getMainDefinition(document);
|
|
5522
5525
|
fragments = getFragmentDefinitions(document);
|
|
@@ -6044,12 +6047,12 @@ var QueryManager = (function () {
|
|
|
6044
6047
|
this.fetchCancelFns.clear();
|
|
6045
6048
|
};
|
|
6046
6049
|
QueryManager.prototype.mutate = function (_a) {
|
|
6047
|
-
|
|
6048
|
-
var mutation = _a.mutation, variables = _a.variables, optimisticResponse = _a.optimisticResponse, updateQueries = _a.updateQueries, _d = _a.refetchQueries, refetchQueries = _d === void 0 ? [] : _d, _e = _a.awaitRefetchQueries, awaitRefetchQueries = _e === void 0 ? false : _e, updateWithProxyFn = _a.update, onQueryUpdated = _a.onQueryUpdated, _f = _a.fetchPolicy, fetchPolicy = _f === void 0 ? ((_b = this.defaultOptions.mutate) === null || _b === void 0 ? void 0 : _b.fetchPolicy) || "network-only" : _f, _g = _a.errorPolicy, errorPolicy = _g === void 0 ? ((_c = this.defaultOptions.mutate) === null || _c === void 0 ? void 0 : _c.errorPolicy) || "none" : _g, keepRootFields = _a.keepRootFields, context = _a.context;
|
|
6049
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
6050
|
+
return tslib.__awaiter(this, arguments, void 0, function (_b) {
|
|
6050
6051
|
var mutationId, hasClientExports, mutationStoreValue, isOptimistic, self;
|
|
6051
|
-
|
|
6052
|
-
|
|
6052
|
+
var _c, _d;
|
|
6053
|
+
var mutation = _b.mutation, variables = _b.variables, optimisticResponse = _b.optimisticResponse, updateQueries = _b.updateQueries, _e = _b.refetchQueries, refetchQueries = _e === void 0 ? [] : _e, _f = _b.awaitRefetchQueries, awaitRefetchQueries = _f === void 0 ? false : _f, updateWithProxyFn = _b.update, onQueryUpdated = _b.onQueryUpdated, _g = _b.fetchPolicy, fetchPolicy = _g === void 0 ? ((_c = this.defaultOptions.mutate) === null || _c === void 0 ? void 0 : _c.fetchPolicy) || "network-only" : _g, _h = _b.errorPolicy, errorPolicy = _h === void 0 ? ((_d = this.defaultOptions.mutate) === null || _d === void 0 ? void 0 : _d.errorPolicy) || "none" : _h, keepRootFields = _b.keepRootFields, context = _b.context;
|
|
6054
|
+
return tslib.__generator(this, function (_j) {
|
|
6055
|
+
switch (_j.label) {
|
|
6053
6056
|
case 0:
|
|
6054
6057
|
invariant(mutation, 26);
|
|
6055
6058
|
invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 27);
|
|
@@ -6060,8 +6063,8 @@ var QueryManager = (function () {
|
|
|
6060
6063
|
if (!hasClientExports) return [3 , 2];
|
|
6061
6064
|
return [4 , this.localState.addExportedVariables(mutation, variables, context)];
|
|
6062
6065
|
case 1:
|
|
6063
|
-
variables = (
|
|
6064
|
-
|
|
6066
|
+
variables = (_j.sent());
|
|
6067
|
+
_j.label = 2;
|
|
6065
6068
|
case 2:
|
|
6066
6069
|
mutationStoreValue = this.mutationStore &&
|
|
6067
6070
|
(this.mutationStore[mutationId] = {
|
|
@@ -7387,7 +7390,7 @@ var RenderDispatcher = null;
|
|
|
7387
7390
|
function useRenderGuard() {
|
|
7388
7391
|
RenderDispatcher = getRenderDispatcher();
|
|
7389
7392
|
return React__namespace.useCallback(function () {
|
|
7390
|
-
return (RenderDispatcher
|
|
7393
|
+
return (RenderDispatcher != null && RenderDispatcher === getRenderDispatcher());
|
|
7391
7394
|
}, []);
|
|
7392
7395
|
}
|
|
7393
7396
|
|
|
@@ -8045,6 +8048,9 @@ function _useFragment(options) {
|
|
|
8045
8048
|
var resultRef = useLazyRef(function () {
|
|
8046
8049
|
return diffToResult(cache.diff(diffOptions));
|
|
8047
8050
|
});
|
|
8051
|
+
React__namespace.useMemo(function () {
|
|
8052
|
+
resultRef.current = diffToResult(cache.diff(diffOptions));
|
|
8053
|
+
}, [diffOptions, cache]);
|
|
8048
8054
|
var getSnapshot = React__namespace.useCallback(function () { return resultRef.current; }, []);
|
|
8049
8055
|
return useSyncExternalStore(React__namespace.useCallback(function (forceUpdate) {
|
|
8050
8056
|
var lastTimeout = 0;
|
|
@@ -8186,7 +8192,8 @@ var InternalQueryReference = (function () {
|
|
|
8186
8192
|
InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) {
|
|
8187
8193
|
var _this = this;
|
|
8188
8194
|
return OBSERVED_CHANGED_OPTIONS.some(function (option) {
|
|
8189
|
-
return
|
|
8195
|
+
return option in watchQueryOptions &&
|
|
8196
|
+
!equal.equal(_this.watchQueryOptions[option], watchQueryOptions[option]);
|
|
8190
8197
|
});
|
|
8191
8198
|
};
|
|
8192
8199
|
InternalQueryReference.prototype.applyOptions = function (watchQueryOptions) {
|
|
@@ -8272,12 +8279,12 @@ var InternalQueryReference = (function () {
|
|
|
8272
8279
|
this.promise = this.createPendingPromise();
|
|
8273
8280
|
this.promise.catch(function () { });
|
|
8274
8281
|
returnedPromise
|
|
8275
|
-
.then(function (
|
|
8282
|
+
.then(function () {
|
|
8276
8283
|
setTimeout(function () {
|
|
8277
8284
|
var _a;
|
|
8278
8285
|
if (_this.promise.status === "pending") {
|
|
8279
|
-
_this.result =
|
|
8280
|
-
(_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, result);
|
|
8286
|
+
_this.result = _this.observable.getCurrentResult();
|
|
8287
|
+
(_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, _this.result);
|
|
8281
8288
|
}
|
|
8282
8289
|
});
|
|
8283
8290
|
})
|