instantsearch.js 4.40.6 → 4.41.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/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # [4.41.0](https://github.com/algolia/instantsearch.js/compare/v4.40.6...v4.41.0) (2022-06-01)
2
+
3
+
4
+ ### Features
5
+
6
+ * **core:** don't schedule search without widgets ([#5056](https://github.com/algolia/instantsearch.js/issues/5056)) ([ea3d6d9](https://github.com/algolia/instantsearch.js/commit/ea3d6d9c6ae1fe2f90bf5643d4bdcbb89507e9bc))
7
+
8
+
9
+
1
10
  ## [4.40.6](https://github.com/algolia/instantsearch.js/compare/v4.40.5...v4.40.6) (2022-05-24)
2
11
 
3
12
 
@@ -481,9 +481,17 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
481
481
  (0, _index2.defer)(function () {
482
482
  _this3.scheduleSearch = originalScheduleSearch;
483
483
  })();
484
- } else {
485
- this.scheduleSearch();
486
- } // Keep the previous reference for legacy purpose, some pattern use
484
+ } // We only schedule a search when widgets have been added before `start()`
485
+ // because there are listeners that can use these results.
486
+ // This is especially useful in framework-based flavors that wait for
487
+ // dynamically-added widgets to trigger a network request. It avoids
488
+ // having to batch this initial network request with the one coming from
489
+ // `addWidgets()`.
490
+ // Later, we could also skip `index()` widgets and widgets that don't read
491
+ // the results, but this is an optimization that has a very low impact for now.
492
+ else if (this.mainIndex.getWidgets().length > 0) {
493
+ this.scheduleSearch();
494
+ } // Keep the previous reference for legacy purpose, some pattern use
487
495
  // the direct Helper access `search.helper` (e.g multi-index).
488
496
 
489
497
 
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = '4.40.6';
7
+ var _default = '4.41.0';
8
8
  exports.default = _default;
@@ -1,4 +1,4 @@
1
- /*! InstantSearch.js 4.40.6 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
1
+ /*! InstantSearch.js 4.41.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -8536,7 +8536,7 @@
8536
8536
  instantSearchInstance.renderState = _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState), {}, _defineProperty({}, parentIndexName, _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState[parentIndexName]), renderState)));
8537
8537
  }
8538
8538
 
8539
- var version$1 = '4.40.6';
8539
+ var version$1 = '4.41.0';
8540
8540
 
8541
8541
  var NAMESPACE = 'ais';
8542
8542
  var component = function component(componentName) {
@@ -10446,9 +10446,17 @@
10446
10446
  defer(function () {
10447
10447
  _this3.scheduleSearch = originalScheduleSearch;
10448
10448
  })();
10449
- } else {
10450
- this.scheduleSearch();
10451
- } // Keep the previous reference for legacy purpose, some pattern use
10449
+ } // We only schedule a search when widgets have been added before `start()`
10450
+ // because there are listeners that can use these results.
10451
+ // This is especially useful in framework-based flavors that wait for
10452
+ // dynamically-added widgets to trigger a network request. It avoids
10453
+ // having to batch this initial network request with the one coming from
10454
+ // `addWidgets()`.
10455
+ // Later, we could also skip `index()` widgets and widgets that don't read
10456
+ // the results, but this is an optimization that has a very low impact for now.
10457
+ else if (this.mainIndex.getWidgets().length > 0) {
10458
+ this.scheduleSearch();
10459
+ } // Keep the previous reference for legacy purpose, some pattern use
10452
10460
  // the direct Helper access `search.helper` (e.g multi-index).
10453
10461
 
10454
10462