react-instantsearch 6.39.1 → 6.40.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.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-instantsearch",
3
- "version": "6.39.1",
3
+ "version": "6.40.1",
4
4
  "description": "⚡ Lightning-fast search for React and React Native apps, by Algolia",
5
5
  "main": "index.js",
6
6
  "module": "dist/es/index.js",
@@ -44,13 +44,13 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@babel/runtime": "^7.1.2",
47
- "react-instantsearch-core": "6.39.1",
48
- "react-instantsearch-dom": "6.39.1",
49
- "react-instantsearch-native": "6.39.1"
47
+ "react-instantsearch-core": "6.40.1",
48
+ "react-instantsearch-dom": "6.40.1",
49
+ "react-instantsearch-native": "6.40.1"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "algoliasearch": ">= 3.1 < 5",
53
53
  "react": ">= 16.3.0 < 19"
54
54
  },
55
- "gitHead": "a00311c99cae3e6f4b9f659945d46d62347bc6d8"
55
+ "gitHead": "f550379829306217e021fd9c538ec4ebd0153b19"
56
56
  }
@@ -196,6 +196,9 @@
196
196
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
197
197
  }, _typeof(obj);
198
198
  }
199
+ // eslint-disable-next-line @typescript-eslint/unbound-method
200
+ var hasOwn = Object.prototype.hasOwnProperty;
201
+
199
202
  // From https://github.com/reactjs/react-redux/blob/master/src/utils/shallowEqual.js
200
203
  var shallowEqual = function shallowEqual(objA, objB) {
201
204
  if (objA === objB) {
@@ -208,7 +211,6 @@
208
211
  }
209
212
 
210
213
  // Test for A's keys different from B.
211
- var hasOwn = Object.prototype.hasOwnProperty;
212
214
  for (var i = 0; i < keysA.length; i++) {
213
215
  if (!hasOwn.call(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
214
216
  return false;
@@ -3829,7 +3831,10 @@
3829
3831
 
3830
3832
  /**
3831
3833
  * sum of the processing time of all the queries
3834
+ * @name processingTimeMS
3832
3835
  * @member {number}
3836
+ * @memberof SearchResults
3837
+ * @instance
3833
3838
  */
3834
3839
  this.processingTimeMS = results.reduce(function(sum, result) {
3835
3840
  return result.processingTimeMS === undefined
@@ -4035,7 +4040,7 @@
4035
4040
 
4036
4041
  self.facets[position] = {
4037
4042
  name: facetName,
4038
- data: mainSubResponse.facets[facetName],
4043
+ data: mainFacets[facetName],
4039
4044
  exhaustive: mainSubResponse.exhaustiveFacetsCount
4040
4045
  };
4041
4046
  excludes.forEach(function(facetValue) {
@@ -5233,7 +5238,7 @@
5233
5238
 
5234
5239
  var requestBuilder_1 = requestBuilder;
5235
5240
 
5236
- var version = '3.11.3';
5241
+ var version = '3.13.2';
5237
5242
 
5238
5243
  var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
5239
5244
 
@@ -6499,7 +6504,9 @@
6499
6504
 
6500
6505
  var derivedQueries = this.derivedHelpers.map(function(derivedHelper) {
6501
6506
  var derivedState = derivedHelper.getModifiedState(state);
6502
- var derivedStateQueries = requestBuilder_1._getQueries(derivedState.index, derivedState);
6507
+ var derivedStateQueries = derivedState.index
6508
+ ? requestBuilder_1._getQueries(derivedState.index, derivedState)
6509
+ : [];
6503
6510
 
6504
6511
  states.push({
6505
6512
  state: derivedState,
@@ -6516,10 +6523,16 @@
6516
6523
  });
6517
6524
 
6518
6525
  var queries = Array.prototype.concat.apply(mainQueries, derivedQueries);
6519
- var queryId = this._queryId++;
6520
6526
 
6527
+ var queryId = this._queryId++;
6521
6528
  this._currentNbQueries++;
6522
6529
 
6530
+ if (!queries.length) {
6531
+ return Promise.resolve({results: []}).then(
6532
+ this._dispatchAlgoliaResponse.bind(this, states, queryId)
6533
+ );
6534
+ }
6535
+
6523
6536
  try {
6524
6537
  this.client.search(queries)
6525
6538
  .then(this._dispatchAlgoliaResponse.bind(this, states, queryId))
@@ -6564,6 +6577,14 @@
6564
6577
  var helper = s.helper;
6565
6578
  var specificResults = results.splice(0, queriesCount);
6566
6579
 
6580
+ if (!state.index) {
6581
+ helper.emit('result', {
6582
+ results: null,
6583
+ state: state
6584
+ });
6585
+ return;
6586
+ }
6587
+
6567
6588
  var formattedResponse = helper.lastResults = new SearchResults_1(state, specificResults);
6568
6589
 
6569
6590
  helper.emit('result', {