@apollo/client 3.8.8 → 3.8.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/CHANGELOG.md +23 -3
- package/apollo-client.cjs +48 -43
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/inmemory/writeToStore.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/dev/dev.cjs +2 -2
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +2 -2
- package/invariantErrorCodes.js +1 -1
- package/link/http/checkFetcher.d.ts +1 -1
- package/link/http/checkFetcher.js.map +1 -1
- package/link/http/http.cjs +0 -3
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +0 -3
- package/link/http/parseAndCheckHttpResponse.js +0 -4
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +1 -1
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/package.json +32 -32
- package/react/cache/QueryReference.js +2 -1
- package/react/cache/QueryReference.js.map +1 -1
- package/react/hooks/hooks.cjs +47 -39
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +47 -39
- package/react/hooks/internal/index.d.ts +1 -0
- package/react/hooks/internal/index.js +1 -0
- package/react/hooks/internal/index.js.map +1 -1
- package/react/hooks/internal/useLazyRef.d.ts +3 -0
- package/react/hooks/internal/useLazyRef.js +10 -0
- package/react/hooks/internal/useLazyRef.js.map +1 -0
- package/react/hooks/useFragment.js +20 -17
- package/react/hooks/useFragment.js.map +1 -1
- package/testing/core/core.cjs +4 -2
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +4 -2
- package/testing/core/mocking/mockLink.js +8 -2
- package/testing/core/mocking/mockLink.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/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @apollo/client
|
|
2
2
|
|
|
3
|
+
## 3.8.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#11489](https://github.com/apollographql/apollo-client/pull/11489) [`abfd02a`](https://github.com/apollographql/apollo-client/commit/abfd02abeb8585e44377e9e87e5d20e5d95be002) Thanks [@gronxb](https://github.com/gronxb)! - Fix `networkStatus` with `useSuspenseQuery` not properly updating to ready state when using a `cache-and-network` fetch policy that returns data equal to what is already in the cache.
|
|
8
|
+
|
|
9
|
+
- [#11483](https://github.com/apollographql/apollo-client/pull/11483) [`6394dda`](https://github.com/apollographql/apollo-client/commit/6394dda47fa83d9ddd922e0d05e62bd872e4ea8e) Thanks [@pipopotamasu](https://github.com/pipopotamasu)! - Fix cache override warning output
|
|
10
|
+
|
|
11
|
+
## 3.8.9
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#11472](https://github.com/apollographql/apollo-client/pull/11472) [`afc844d`](https://github.com/apollographql/apollo-client/commit/afc844dd8d6f9f7a3e2003f9a5b541291dfe3fb4) Thanks [@alessbell](https://github.com/alessbell)! - Fix delay: Infinity when set on a MockResponse passed to Mocked Provider so it indefinitely enters loading state.
|
|
16
|
+
|
|
17
|
+
- [#11464](https://github.com/apollographql/apollo-client/pull/11464) [`aac12b2`](https://github.com/apollographql/apollo-client/commit/aac12b221a6cb776d4941b6c8aadf04f0f0acd27) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Prevent `useFragment` from excessively unsubscribing and resubscribing the fragment with the cache on every render.
|
|
18
|
+
|
|
19
|
+
- [#11449](https://github.com/apollographql/apollo-client/pull/11449) [`f40cda4`](https://github.com/apollographql/apollo-client/commit/f40cda45841e93b056c781c19651b54464f7346a) Thanks [@phryneas](https://github.com/phryneas)! - Removes refences to the typescript "dom" lib.
|
|
20
|
+
|
|
21
|
+
- [#11470](https://github.com/apollographql/apollo-client/pull/11470) [`e293bc9`](https://github.com/apollographql/apollo-client/commit/e293bc90d6f7937a6fc7c169f7b16eeb39d5fd49) Thanks [@phryneas](https://github.com/phryneas)! - Remove an unnecessary check from parseAndCheckHttpResponse.
|
|
22
|
+
|
|
3
23
|
## 3.8.8
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -199,7 +219,7 @@
|
|
|
199
219
|
return data.breeds.map(({ characteristics }) =>
|
|
200
220
|
characteristics.map((characteristic) => (
|
|
201
221
|
<div key={characteristic}>{characteristic}</div>
|
|
202
|
-
))
|
|
222
|
+
)),
|
|
203
223
|
);
|
|
204
224
|
}
|
|
205
225
|
```
|
|
@@ -250,7 +270,7 @@
|
|
|
250
270
|
|
|
251
271
|
const { data } = useSuspenseQuery(
|
|
252
272
|
query,
|
|
253
|
-
id ? { variables: { id } } : skipToken
|
|
273
|
+
id ? { variables: { id } } : skipToken,
|
|
254
274
|
);
|
|
255
275
|
```
|
|
256
276
|
|
|
@@ -2205,7 +2225,7 @@ In upcoming v3.6.x and v3.7 (beta) releases, we will be completely overhauling o
|
|
|
2205
2225
|
fields: {
|
|
2206
2226
|
comments(comments: Reference[], { readField }) {
|
|
2207
2227
|
return comments.filter(
|
|
2208
|
-
(comment) => idToRemove !== readField("id", comment)
|
|
2228
|
+
(comment) => idToRemove !== readField("id", comment),
|
|
2209
2229
|
);
|
|
2210
2230
|
},
|
|
2211
2231
|
},
|
package/apollo-client.cjs
CHANGED
|
@@ -30,7 +30,7 @@ function _interopNamespace(e) {
|
|
|
30
30
|
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
31
31
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
32
32
|
|
|
33
|
-
var version = "3.8.
|
|
33
|
+
var version = "3.8.10";
|
|
34
34
|
|
|
35
35
|
function maybe(thunk) {
|
|
36
36
|
try {
|
|
@@ -1894,9 +1894,6 @@ function parseAndCheckHttpResponse(operations) {
|
|
|
1894
1894
|
.text()
|
|
1895
1895
|
.then(function (bodyText) { return parseJsonBody(response, bodyText); })
|
|
1896
1896
|
.then(function (result) {
|
|
1897
|
-
if (response.status >= 300) {
|
|
1898
|
-
throwServerError(response, result, "Response not successful: Received status code ".concat(response.status));
|
|
1899
|
-
}
|
|
1900
1897
|
if (!Array.isArray(result) &&
|
|
1901
1898
|
!hasOwnProperty$3.call(result, "data") &&
|
|
1902
1899
|
!hasOwnProperty$3.call(result, "errors")) {
|
|
@@ -7769,44 +7766,6 @@ function useReactiveVar(rv) {
|
|
|
7769
7766
|
}, [rv]), rv, rv);
|
|
7770
7767
|
}
|
|
7771
7768
|
|
|
7772
|
-
function useFragment(options) {
|
|
7773
|
-
var cache = useApolloClient().cache;
|
|
7774
|
-
var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, rest = tslib.__rest(options, ["fragment", "fragmentName", "from", "optimistic"]);
|
|
7775
|
-
var diffOptions = tslib.__assign(tslib.__assign({}, rest), { returnPartialData: true, id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
|
|
7776
|
-
var resultRef = React__namespace.useRef();
|
|
7777
|
-
var latestDiff = cache.diff(diffOptions);
|
|
7778
|
-
var getSnapshot = function () {
|
|
7779
|
-
var latestDiffToResult = diffToResult(latestDiff);
|
|
7780
|
-
return (resultRef.current &&
|
|
7781
|
-
equal.equal(resultRef.current.data, latestDiffToResult.data)) ?
|
|
7782
|
-
resultRef.current
|
|
7783
|
-
: (resultRef.current = latestDiffToResult);
|
|
7784
|
-
};
|
|
7785
|
-
return useSyncExternalStore(function (forceUpdate) {
|
|
7786
|
-
var lastTimeout = 0;
|
|
7787
|
-
var unsubcribe = cache.watch(tslib.__assign(tslib.__assign({}, diffOptions), { immediate: true, callback: function (diff) {
|
|
7788
|
-
if (!equal.equal(diff, latestDiff)) {
|
|
7789
|
-
resultRef.current = diffToResult((latestDiff = diff));
|
|
7790
|
-
lastTimeout = setTimeout(forceUpdate);
|
|
7791
|
-
}
|
|
7792
|
-
} }));
|
|
7793
|
-
return function () {
|
|
7794
|
-
unsubcribe();
|
|
7795
|
-
clearTimeout(lastTimeout);
|
|
7796
|
-
};
|
|
7797
|
-
}, getSnapshot, getSnapshot);
|
|
7798
|
-
}
|
|
7799
|
-
function diffToResult(diff) {
|
|
7800
|
-
var result = {
|
|
7801
|
-
data: diff.result,
|
|
7802
|
-
complete: !!diff.complete,
|
|
7803
|
-
};
|
|
7804
|
-
if (diff.missing) {
|
|
7805
|
-
result.missing = mergeDeepArray(diff.missing.map(function (error) { return error.missing; }));
|
|
7806
|
-
}
|
|
7807
|
-
return result;
|
|
7808
|
-
}
|
|
7809
|
-
|
|
7810
7769
|
function useDeepMemo(memoFn, deps) {
|
|
7811
7770
|
var ref = React__namespace.useRef();
|
|
7812
7771
|
if (!ref.current || !equal.equal(ref.current.deps, deps)) {
|
|
@@ -7815,6 +7774,15 @@ function useDeepMemo(memoFn, deps) {
|
|
|
7815
7774
|
return ref.current.value;
|
|
7816
7775
|
}
|
|
7817
7776
|
|
|
7777
|
+
var INIT = {};
|
|
7778
|
+
function useLazyRef(getInitialValue) {
|
|
7779
|
+
var ref = React__namespace.useRef(INIT);
|
|
7780
|
+
if (ref.current === INIT) {
|
|
7781
|
+
ref.current = getInitialValue();
|
|
7782
|
+
}
|
|
7783
|
+
return ref;
|
|
7784
|
+
}
|
|
7785
|
+
|
|
7818
7786
|
var useKey = "use";
|
|
7819
7787
|
var realHook = React__namespace[useKey];
|
|
7820
7788
|
var __use = realHook ||
|
|
@@ -7830,6 +7798,42 @@ var __use = realHook ||
|
|
|
7830
7798
|
}
|
|
7831
7799
|
};
|
|
7832
7800
|
|
|
7801
|
+
function useFragment(options) {
|
|
7802
|
+
var cache = useApolloClient().cache;
|
|
7803
|
+
var diffOptions = useDeepMemo(function () {
|
|
7804
|
+
var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, rest = tslib.__rest(options, ["fragment", "fragmentName", "from", "optimistic"]);
|
|
7805
|
+
return tslib.__assign(tslib.__assign({}, rest), { returnPartialData: true, id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
|
|
7806
|
+
}, [options]);
|
|
7807
|
+
var resultRef = useLazyRef(function () {
|
|
7808
|
+
return diffToResult(cache.diff(diffOptions));
|
|
7809
|
+
});
|
|
7810
|
+
var getSnapshot = React__namespace.useCallback(function () { return resultRef.current; }, []);
|
|
7811
|
+
return useSyncExternalStore(React__namespace.useCallback(function (forceUpdate) {
|
|
7812
|
+
var lastTimeout = 0;
|
|
7813
|
+
var unsubscribe = cache.watch(tslib.__assign(tslib.__assign({}, diffOptions), { immediate: true, callback: function (diff) {
|
|
7814
|
+
if (!equal.equal(diff.result, resultRef.current.data)) {
|
|
7815
|
+
resultRef.current = diffToResult(diff);
|
|
7816
|
+
clearTimeout(lastTimeout);
|
|
7817
|
+
lastTimeout = setTimeout(forceUpdate);
|
|
7818
|
+
}
|
|
7819
|
+
} }));
|
|
7820
|
+
return function () {
|
|
7821
|
+
unsubscribe();
|
|
7822
|
+
clearTimeout(lastTimeout);
|
|
7823
|
+
};
|
|
7824
|
+
}, [cache, diffOptions]), getSnapshot, getSnapshot);
|
|
7825
|
+
}
|
|
7826
|
+
function diffToResult(diff) {
|
|
7827
|
+
var result = {
|
|
7828
|
+
data: diff.result,
|
|
7829
|
+
complete: !!diff.complete,
|
|
7830
|
+
};
|
|
7831
|
+
if (diff.missing) {
|
|
7832
|
+
result.missing = mergeDeepArray(diff.missing.map(function (error) { return error.missing; }));
|
|
7833
|
+
}
|
|
7834
|
+
return result;
|
|
7835
|
+
}
|
|
7836
|
+
|
|
7833
7837
|
var QUERY_REFERENCE_SYMBOL = Symbol();
|
|
7834
7838
|
function wrapQueryRef(internalQueryRef) {
|
|
7835
7839
|
var _a;
|
|
@@ -7968,7 +7972,8 @@ var InternalQueryReference = (function () {
|
|
|
7968
7972
|
break;
|
|
7969
7973
|
}
|
|
7970
7974
|
case "idle": {
|
|
7971
|
-
if (result.data === this.result.data
|
|
7975
|
+
if (result.data === this.result.data &&
|
|
7976
|
+
result.networkStatus === this.result.networkStatus) {
|
|
7972
7977
|
return;
|
|
7973
7978
|
}
|
|
7974
7979
|
if (result.data === void 0) {
|