react-instantsearch 6.39.1 → 6.40.0

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.0",
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.0",
48
+ "react-instantsearch-dom": "6.40.0",
49
+ "react-instantsearch-native": "6.40.0"
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": "ea054eab1484a3d167db83bc768f6ea134add5f9"
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;
@@ -5233,7 +5235,7 @@
5233
5235
 
5234
5236
  var requestBuilder_1 = requestBuilder;
5235
5237
 
5236
- var version = '3.11.3';
5238
+ var version = '3.13.0';
5237
5239
 
5238
5240
  var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
5239
5241
 
@@ -6499,7 +6501,9 @@
6499
6501
 
6500
6502
  var derivedQueries = this.derivedHelpers.map(function(derivedHelper) {
6501
6503
  var derivedState = derivedHelper.getModifiedState(state);
6502
- var derivedStateQueries = requestBuilder_1._getQueries(derivedState.index, derivedState);
6504
+ var derivedStateQueries = derivedState.index
6505
+ ? requestBuilder_1._getQueries(derivedState.index, derivedState)
6506
+ : [];
6503
6507
 
6504
6508
  states.push({
6505
6509
  state: derivedState,
@@ -6516,10 +6520,16 @@
6516
6520
  });
6517
6521
 
6518
6522
  var queries = Array.prototype.concat.apply(mainQueries, derivedQueries);
6519
- var queryId = this._queryId++;
6520
6523
 
6524
+ var queryId = this._queryId++;
6521
6525
  this._currentNbQueries++;
6522
6526
 
6527
+ if (!queries.length) {
6528
+ return Promise.resolve({results: []}).then(
6529
+ this._dispatchAlgoliaResponse.bind(this, states, queryId)
6530
+ );
6531
+ }
6532
+
6523
6533
  try {
6524
6534
  this.client.search(queries)
6525
6535
  .then(this._dispatchAlgoliaResponse.bind(this, states, queryId))
@@ -6564,6 +6574,14 @@
6564
6574
  var helper = s.helper;
6565
6575
  var specificResults = results.splice(0, queriesCount);
6566
6576
 
6577
+ if (!state.index) {
6578
+ helper.emit('result', {
6579
+ results: null,
6580
+ state: state
6581
+ });
6582
+ return;
6583
+ }
6584
+
6567
6585
  var formattedResponse = helper.lastResults = new SearchResults_1(state, specificResults);
6568
6586
 
6569
6587
  helper.emit('result', {