@apollo/client 3.7.9 → 3.7.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/apollo-client.cjs CHANGED
@@ -380,17 +380,21 @@ function checkDocument(doc) {
380
380
  }
381
381
  function getOperationDefinition(doc) {
382
382
  checkDocument(doc);
383
- return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0];
383
+ return doc.definitions.filter(function (definition) {
384
+ return definition.kind === 'OperationDefinition';
385
+ })[0];
384
386
  }
385
387
  function getOperationName(doc) {
386
388
  return (doc.definitions
387
389
  .filter(function (definition) {
388
- return definition.kind === 'OperationDefinition' && definition.name;
390
+ return definition.kind === 'OperationDefinition' && !!definition.name;
389
391
  })
390
392
  .map(function (x) { return x.name.value; })[0] || null);
391
393
  }
392
394
  function getFragmentDefinitions(doc) {
393
- return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; });
395
+ return doc.definitions.filter(function (definition) {
396
+ return definition.kind === 'FragmentDefinition';
397
+ });
394
398
  }
395
399
  function getQueryDefinition(doc) {
396
400
  var queryDef = getOperationDefinition(doc);
@@ -1353,7 +1357,7 @@ var concat = ApolloLink.concat;
1353
1357
 
1354
1358
  var execute = ApolloLink.execute;
1355
1359
 
1356
- var version = '3.7.9';
1360
+ var version = '3.7.10';
1357
1361
 
1358
1362
  function isNodeResponse(value) {
1359
1363
  return !!value.body;
@@ -6374,12 +6378,18 @@ var ApolloClient = (function () {
6374
6378
  return this.cache.readFragment(options, optimistic);
6375
6379
  };
6376
6380
  ApolloClient.prototype.writeQuery = function (options) {
6377
- this.cache.writeQuery(options);
6378
- this.queryManager.broadcastQueries();
6381
+ var ref = this.cache.writeQuery(options);
6382
+ if (options.broadcast !== false) {
6383
+ this.queryManager.broadcastQueries();
6384
+ }
6385
+ return ref;
6379
6386
  };
6380
6387
  ApolloClient.prototype.writeFragment = function (options) {
6381
- this.cache.writeFragment(options);
6382
- this.queryManager.broadcastQueries();
6388
+ var ref = this.cache.writeFragment(options);
6389
+ if (options.broadcast !== false) {
6390
+ this.queryManager.broadcastQueries();
6391
+ }
6392
+ return ref;
6383
6393
  };
6384
6394
  ApolloClient.prototype.__actionHookForDevTools = function (cb) {
6385
6395
  this.devToolsHookCb = cb;
@@ -7027,8 +7037,9 @@ function useMutation(mutation, options) {
7027
7037
  }
7028
7038
  var execute = React.useCallback(function (executeOptions) {
7029
7039
  if (executeOptions === void 0) { executeOptions = {}; }
7030
- var _a = ref.current, client = _a.client, options = _a.options, mutation = _a.mutation;
7040
+ var _a = ref.current, options = _a.options, mutation = _a.mutation;
7031
7041
  var baseOptions = tslib.__assign(tslib.__assign({}, options), { mutation: mutation });
7042
+ var client = executeOptions.client || ref.current.client;
7032
7043
  if (!ref.current.result.loading && !baseOptions.ignoreResults && ref.current.isMounted) {
7033
7044
  setResult(ref.current.result = {
7034
7045
  loading: true,