@apollo/client 3.7.4 → 3.7.5

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 (42) hide show
  1. package/apollo-client.cjs +19 -10
  2. package/apollo-client.cjs.map +1 -1
  3. package/apollo-client.min.cjs +1 -1
  4. package/core/QueryManager.d.ts.map +1 -1
  5. package/core/QueryManager.js +5 -0
  6. package/core/QueryManager.js.map +1 -1
  7. package/core/core.cjs +6 -1
  8. package/core/core.cjs.map +1 -1
  9. package/core/core.cjs.native.js +6 -1
  10. package/core/types.d.ts +2 -1
  11. package/core/types.d.ts.map +1 -1
  12. package/core/types.js +1 -0
  13. package/core/types.js.map +1 -1
  14. package/core/watchQueryOptions.d.ts +2 -2
  15. package/core/watchQueryOptions.d.ts.map +1 -1
  16. package/core/watchQueryOptions.js.map +1 -1
  17. package/invariantErrorCodes.js +1 -1
  18. package/link/context/index.d.ts +2 -1
  19. package/link/context/index.d.ts.map +1 -1
  20. package/link/context/index.js.map +1 -1
  21. package/link/core/types.d.ts +5 -4
  22. package/link/core/types.d.ts.map +1 -1
  23. package/link/core/types.js.map +1 -1
  24. package/link/http/createHttpLink.d.ts.map +1 -1
  25. package/link/http/createHttpLink.js +1 -0
  26. package/link/http/createHttpLink.js.map +1 -1
  27. package/link/http/http.cjs +4 -1
  28. package/link/http/http.cjs.map +1 -1
  29. package/link/http/http.cjs.native.js +4 -1
  30. package/link/http/selectHttpOptionsAndBody.d.ts +2 -2
  31. package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
  32. package/link/http/selectHttpOptionsAndBody.js +3 -1
  33. package/link/http/selectHttpOptionsAndBody.js.map +1 -1
  34. package/package.json +12 -12
  35. package/react/hooks/hooks.cjs +9 -8
  36. package/react/hooks/hooks.cjs.map +1 -1
  37. package/react/hooks/hooks.cjs.native.js +9 -8
  38. package/react/hooks/useFragment.d.ts +2 -1
  39. package/react/hooks/useFragment.d.ts.map +1 -1
  40. package/react/hooks/useFragment.js +9 -8
  41. package/react/hooks/useFragment.js.map +1 -1
  42. package/version.js +1 -1
package/apollo-client.cjs CHANGED
@@ -1345,7 +1345,7 @@ var concat = ApolloLink.concat;
1345
1345
 
1346
1346
  var execute = ApolloLink.execute;
1347
1347
 
1348
- var version = '3.7.4';
1348
+ var version = '3.7.5';
1349
1349
 
1350
1350
  function isNodeResponse(value) {
1351
1351
  return !!value.body;
@@ -1709,7 +1709,9 @@ function selectHttpOptionsAndBodyInternal(operation, printer) {
1709
1709
  }
1710
1710
  http = tslib.__assign(tslib.__assign({}, http), config.http);
1711
1711
  });
1712
- options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase);
1712
+ if (options.headers) {
1713
+ options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase);
1714
+ }
1713
1715
  var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query;
1714
1716
  var body = { operationName: operationName, variables: variables };
1715
1717
  if (http.includeExtensions)
@@ -1875,6 +1877,7 @@ var createHttpLink = function (linkOptions) {
1875
1877
  options.method = 'GET';
1876
1878
  }
1877
1879
  if (hasDirectives(['defer'], operation.query)) {
1880
+ options.headers = options.headers || {};
1878
1881
  options.headers.accept = "multipart/mixed; deferSpec=20220824, application/json";
1879
1882
  }
1880
1883
  if (options.method === 'GET') {
@@ -6082,6 +6085,11 @@ var QueryManager = (function () {
6082
6085
  onlyRunForcedResolvers: true,
6083
6086
  }).then(function (resolved) { return fromData(resolved.data || void 0); });
6084
6087
  }
6088
+ if (errorPolicy === 'none' &&
6089
+ networkStatus === exports.NetworkStatus.refetch &&
6090
+ Array.isArray(diff.missing)) {
6091
+ return fromData(void 0);
6092
+ }
6085
6093
  return fromData(data);
6086
6094
  };
6087
6095
  var cacheWriteBehavior = fetchPolicy === "no-cache" ? 0 :
@@ -7189,20 +7197,21 @@ function useFragment_experimental(options) {
7189
7197
  var diffOptions = tslib.__assign(tslib.__assign({}, rest), { id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
7190
7198
  var resultRef = React.useRef();
7191
7199
  var latestDiff = cache.diff(diffOptions);
7200
+ var getSnapshot = function () {
7201
+ var latestDiffToResult = diffToResult(latestDiff);
7202
+ return resultRef.current &&
7203
+ equality.equal(resultRef.current.data, latestDiffToResult.data)
7204
+ ? resultRef.current
7205
+ : (resultRef.current = latestDiffToResult);
7206
+ };
7192
7207
  return useSyncExternalStore(function (forceUpdate) {
7193
7208
  return cache.watch(tslib.__assign(tslib.__assign({}, diffOptions), { immediate: true, callback: function (diff) {
7194
7209
  if (!equality.equal(diff, latestDiff)) {
7195
- resultRef.current = diffToResult(latestDiff = diff);
7210
+ resultRef.current = diffToResult((latestDiff = diff));
7196
7211
  forceUpdate();
7197
7212
  }
7198
7213
  } }));
7199
- }, function () {
7200
- var latestDiffToResult = diffToResult(latestDiff);
7201
- return resultRef.current &&
7202
- equality.equal(resultRef.current.data, latestDiffToResult.data)
7203
- ? resultRef.current
7204
- : (resultRef.current = latestDiffToResult);
7205
- });
7214
+ }, getSnapshot, getSnapshot);
7206
7215
  }
7207
7216
  function diffToResult(diff) {
7208
7217
  var result = {