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.
@@ -460,9 +460,17 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
460
460
  defer(function () {
461
461
  _this3.scheduleSearch = originalScheduleSearch;
462
462
  })();
463
- } else {
464
- this.scheduleSearch();
465
- } // Keep the previous reference for legacy purpose, some pattern use
463
+ } // We only schedule a search when widgets have been added before `start()`
464
+ // because there are listeners that can use these results.
465
+ // This is especially useful in framework-based flavors that wait for
466
+ // dynamically-added widgets to trigger a network request. It avoids
467
+ // having to batch this initial network request with the one coming from
468
+ // `addWidgets()`.
469
+ // Later, we could also skip `index()` widgets and widgets that don't read
470
+ // the results, but this is an optimization that has a very low impact for now.
471
+ else if (this.mainIndex.getWidgets().length > 0) {
472
+ this.scheduleSearch();
473
+ } // Keep the previous reference for legacy purpose, some pattern use
466
474
  // the direct Helper access `search.helper` (e.g multi-index).
467
475
 
468
476
 
@@ -1,2 +1,2 @@
1
- declare const _default: "4.40.6";
1
+ declare const _default: "4.41.0";
2
2
  export default _default;
package/es/lib/version.js CHANGED
@@ -1 +1 @@
1
- export default '4.40.6';
1
+ export default '4.41.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instantsearch.js",
3
- "version": "4.40.6",
3
+ "version": "4.41.0",
4
4
  "description": "InstantSearch.js is a JavaScript library for building performant and instant search experiences with Algolia.",
5
5
  "homepage": "https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/",
6
6
  "types": "es/index.d.ts",