react-instantsearch-core 7.50.0 → 7.50.1

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.
@@ -9,4 +9,4 @@ Object.defineProperty(exports, "default", {
9
9
  return _default;
10
10
  }
11
11
  });
12
- var _default = '7.50.0';
12
+ var _default = '7.50.1';
@@ -1,2 +1,2 @@
1
- declare const _default: "7.50.0";
1
+ declare const _default: "7.50.1";
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
- var version = '7.50.0';
1
+ var version = '7.50.1';
2
2
 
3
3
  export { version as default };
@@ -1,4 +1,4 @@
1
- /*! React InstantSearch Core 7.50.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
1
+ /*! React InstantSearch Core 7.50.1 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
@@ -24,7 +24,7 @@
24
24
 
25
25
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
26
26
 
27
- var version$2 = '7.50.0';
27
+ var version$2 = '7.50.1';
28
28
 
29
29
  function _define_property(obj, key, value) {
30
30
  if (key in obj) {
@@ -3919,7 +3919,7 @@
3919
3919
  function requireVersion() {
3920
3920
  if (hasRequiredVersion) return version$1;
3921
3921
  hasRequiredVersion = 1;
3922
- version$1 = '3.29.3';
3922
+ version$1 = '3.29.4';
3923
3923
  return version$1;
3924
3924
  }
3925
3925
 
@@ -5259,15 +5259,45 @@
5259
5259
  return derivedStateQueries;
5260
5260
  });
5261
5261
  var queries = Array.prototype.concat.apply(mainQueries, derivedQueries);
5262
+ var uniqueQueries = [];
5263
+ var deduplicationMap = [];
5264
+ var deduplicated = false;
5265
+ var queryKeys = {};
5266
+ queries.forEach(function(query) {
5267
+ var key = JSON.stringify({
5268
+ indexName: query.indexName,
5269
+ params: query.params
5270
+ });
5271
+ if (Object.prototype.hasOwnProperty.call(queryKeys, key)) {
5272
+ var index = queryKeys[key];
5273
+ deduplicationMap.push(index);
5274
+ deduplicated = true;
5275
+ } else {
5276
+ var newIndex = uniqueQueries.length;
5277
+ uniqueQueries.push(query);
5278
+ queryKeys[key] = newIndex;
5279
+ deduplicationMap.push(newIndex);
5280
+ }
5281
+ });
5262
5282
  var queryId = this._queryId++;
5263
5283
  this._currentNbQueries++;
5264
- if (!queries.length) {
5284
+ if (!uniqueQueries.length) {
5265
5285
  return Promise.resolve({
5266
5286
  results: []
5267
5287
  }).then(this._dispatchAlgoliaResponse.bind(this, states, queryId));
5268
5288
  }
5269
5289
  try {
5270
- this.client.search(queries).then(this._dispatchAlgoliaResponse.bind(this, states, queryId)).catch(this._dispatchAlgoliaError.bind(this, queryId));
5290
+ var searchPromise = this.client.search(uniqueQueries);
5291
+ if (deduplicated) {
5292
+ searchPromise = searchPromise.then(function(res) {
5293
+ return {
5294
+ results: deduplicationMap.map(function(index) {
5295
+ return res.results[index];
5296
+ })
5297
+ };
5298
+ });
5299
+ }
5300
+ searchPromise.then(this._dispatchAlgoliaResponse.bind(this, states, queryId)).catch(this._dispatchAlgoliaError.bind(this, queryId));
5271
5301
  } catch (error) {
5272
5302
  // If we reach this part, we're in an internal error state
5273
5303
  this.emit('error', {
@@ -9418,7 +9448,7 @@
9418
9448
  });
9419
9449
  }
9420
9450
 
9421
- var version = '4.118.0';
9451
+ var version = '4.118.1';
9422
9452
 
9423
9453
  var ANONYMOUS_TOKEN_COOKIE_KEY = '_ALGOLIA';
9424
9454
  function getCookie(name) {
@@ -17354,7 +17384,7 @@
17354
17384
  objectID: objectID,
17355
17385
  maxRecommendations: limit,
17356
17386
  threshold: threshold,
17357
- // @ts-expect-error until @algolia/recommend types are updated
17387
+ // @ts-ignore until @algolia/recommend types are updated
17358
17388
  fallbackParameters: fallbackParameters ? _object_spread({}, fallbackParameters, escapeHTML ? TAG_PLACEHOLDER : {}) : undefined,
17359
17389
  queryParameters: _object_spread({}, queryParameters, escapeHTML ? TAG_PLACEHOLDER : {}),
17360
17390
  $$id: _this.$$id