@apollo/client 3.12.3 → 3.12.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # @apollo/client
2
2
 
3
+ ## 3.12.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#12252](https://github.com/apollographql/apollo-client/pull/12252) [`cb9cd4e`](https://github.com/apollographql/apollo-client/commit/cb9cd4ea251aab225adf5e4e4f3f69e1bbacee52) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Changes the default behavior of the `MaybeMasked` type to preserve types unless otherwise specified. This change makes it easier to upgrade from older versions of the client where types could have unexpectedly changed in the application due to the default of trying to unwrap types into unmasked types. This change also fixes the compilation performance regression experienced when simply upgrading the client since types are now preserved by default.
8
+
9
+ A new `mode` option has now been introduced to allow for the old behavior. See the next section on migrating if you wish to maintain the old default behavior after upgrading to this version.
10
+
11
+ ### Migrating from <= v3.12.4
12
+
13
+ If you've adopted data masking and have opted in to using masked types by setting the `enabled` property to `true`, you can remove this configuration entirely:
14
+
15
+ ```diff
16
+ -declare module "@apollo/client" {
17
+ - interface DataMasking {
18
+ - mode: "unmask"
19
+ - }
20
+ -}
21
+ ```
22
+
23
+ If you prefer to specify the behavior explicitly, change the property from `enabled: true`, to `mode: "preserveTypes"`:
24
+
25
+ ```diff
26
+ declare module "@apollo/client" {
27
+ interface DataMasking {
28
+ - enabled: true
29
+ + mode: "preserveTypes"
30
+ }
31
+ }
32
+ ```
33
+
34
+ If you rely on the default behavior in 3.12.4 or below and would like to continue to use unmasked types by default, set the `mode` to `unmask`:
35
+
36
+ ```ts
37
+ declare module "@apollo/client" {
38
+ interface DataMasking {
39
+ mode: "unmask";
40
+ }
41
+ }
42
+ ```
43
+
44
+ ## 3.12.4
45
+
46
+ ### Patch Changes
47
+
48
+ - [#12236](https://github.com/apollographql/apollo-client/pull/12236) [`4334d30`](https://github.com/apollographql/apollo-client/commit/4334d30cc3fbedb4f736eff196c49a9f20a46704) Thanks [@charpeni](https://github.com/charpeni)! - Fix an issue with `refetchQueries` where comparing `DocumentNode`s internally by references could lead to an unknown query, even though the `DocumentNode` was indeed an active query—with a different reference.
49
+
3
50
  ## 3.12.3
4
51
 
5
52
  ### Patch Changes
package/README.md CHANGED
@@ -5,13 +5,13 @@
5
5
  </p>
6
6
  <h1>Apollo Client</h1>
7
7
 
8
- [![npm version](https://badge.fury.io/js/%40apollo%2Fclient.svg)](https://badge.fury.io/js/%40apollo%2Fclient) [![Build Status](https://circleci.com/gh/apollographql/apollo-client.svg?style=svg)](https://circleci.com/gh/apollographql/apollo-client) [![Join the community](https://img.shields.io/discourse/status?label=Join%20the%20community&server=https%3A%2F%2Fcommunity.apollographql.com)](https://community.apollographql.com) [![Join our Discord server](https://img.shields.io/discord/1022972389463687228.svg?color=7389D8&labelColor=6A7EC2&logo=discord&logoColor=ffffff&style=flat-square)](https://discord.gg/graphos)
8
+ [![npm version](https://badge.fury.io/js/%40apollo%2Fclient.svg)](https://badge.fury.io/js/%40apollo%2Fclient) [![Build Status](https://circleci.com/gh/apollographql/apollo-client.svg?style=svg)](https://circleci.com/gh/apollographql/apollo-client) [![Join the community](https://img.shields.io/discourse/status?label=Join%20the%20community&server=https%3A%2F%2Fcommunity.apollographql.com)](https://community.apollographql.com)
9
9
 
10
10
  </div>
11
11
 
12
12
  ---
13
13
 
14
- **Announcement:**
14
+ **Announcement:**
15
15
  Join 1000+ engineers at GraphQL Summit for talks, workshops, and office hours, Oct 8-10 in NYC. [Get your pass here ->](https://summit.graphql.com/?utm_campaign=github_federation_readme)
16
16
 
17
17
  ---
@@ -39,10 +39,7 @@ Learn how to use Apollo Client with self-paced hands-on training on Odyssey, Apo
39
39
 
40
40
  |Name|Username|
41
41
  |---|---|
42
- |Ben Newman|[@benjamn](https://github.com/benjamn)|
43
- |Alessia Bellisario|[@alessbell](https://github.com/alessbell)|
44
42
  |Jeff Auriemma|[@bignimbus](https://github.com/bignimbus)|
45
- |Hugh Willson|[@hwillson](https://github.com/hwillson)|
46
43
  |Jerel Miller|[@jerelmiller](https://github.com/jerelmiller)|
47
44
  |Lenz Weber-Tronic|[@phryneas](https://github.com/phryneas)|
48
45
 
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.12.3";
34
+ var version = "3.12.5";
35
35
 
36
36
  function maybe(thunk) {
37
37
  try {
@@ -6486,15 +6486,19 @@ var QueryManager = (function () {
6486
6486
  var _this = this;
6487
6487
  if (include === void 0) { include = "active"; }
6488
6488
  var queries = new Map();
6489
- var queryNamesAndDocs = new Map();
6489
+ var queryNames = new Map();
6490
+ var queryNamesAndQueryStrings = new Map();
6490
6491
  var legacyQueryOptions = new Set();
6491
6492
  if (Array.isArray(include)) {
6492
6493
  include.forEach(function (desc) {
6493
6494
  if (typeof desc === "string") {
6494
- queryNamesAndDocs.set(desc, false);
6495
+ queryNames.set(desc, desc);
6496
+ queryNamesAndQueryStrings.set(desc, false);
6495
6497
  }
6496
6498
  else if (isDocumentNode(desc)) {
6497
- queryNamesAndDocs.set(_this.transform(desc), false);
6499
+ var queryString = print(_this.transform(desc));
6500
+ queryNames.set(queryString, getOperationName(desc));
6501
+ queryNamesAndQueryStrings.set(queryString, false);
6498
6502
  }
6499
6503
  else if (isNonNullObject(desc) && desc.query) {
6500
6504
  legacyQueryOptions.add(desc);
@@ -6514,13 +6518,13 @@ var QueryManager = (function () {
6514
6518
  return;
6515
6519
  }
6516
6520
  if (include === "active" ||
6517
- (queryName && queryNamesAndDocs.has(queryName)) ||
6518
- (document && queryNamesAndDocs.has(document))) {
6521
+ (queryName && queryNamesAndQueryStrings.has(queryName)) ||
6522
+ (document && queryNamesAndQueryStrings.has(print(document)))) {
6519
6523
  queries.set(queryId, oq);
6520
6524
  if (queryName)
6521
- queryNamesAndDocs.set(queryName, true);
6525
+ queryNamesAndQueryStrings.set(queryName, true);
6522
6526
  if (document)
6523
- queryNamesAndDocs.set(document, true);
6527
+ queryNamesAndQueryStrings.set(print(document), true);
6524
6528
  }
6525
6529
  }
6526
6530
  });
@@ -6541,10 +6545,16 @@ var QueryManager = (function () {
6541
6545
  queries.set(queryId, oq);
6542
6546
  });
6543
6547
  }
6544
- if (globalThis.__DEV__ !== false && queryNamesAndDocs.size) {
6545
- queryNamesAndDocs.forEach(function (included, nameOrDoc) {
6548
+ if (globalThis.__DEV__ !== false && queryNamesAndQueryStrings.size) {
6549
+ queryNamesAndQueryStrings.forEach(function (included, nameOrQueryString) {
6546
6550
  if (!included) {
6547
- globalThis.__DEV__ !== false && invariant.warn(typeof nameOrDoc === "string" ? 35 : 36, nameOrDoc);
6551
+ var queryName = queryNames.get(nameOrQueryString);
6552
+ if (queryName) {
6553
+ globalThis.__DEV__ !== false && invariant.warn(35, queryName);
6554
+ }
6555
+ else {
6556
+ globalThis.__DEV__ !== false && invariant.warn(36);
6557
+ }
6548
6558
  }
6549
6559
  });
6550
6560
  }