instantsearch.js 4.39.2 → 4.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/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # [4.40.0](https://github.com/algolia/instantsearch.js/compare/v4.39.2...v4.40.0) (2022-03-21)
2
+
3
+
4
+ ### Features
5
+
6
+ * **infiniteHits:** avoid caching artificial results ([#5023](https://github.com/algolia/instantsearch.js/issues/5023)) ([e8c0145](https://github.com/algolia/instantsearch.js/commit/e8c01452ebe77b82b8a107c5d4fc026abf5645d8))
7
+
8
+
9
+
1
10
  ## [4.39.2](https://github.com/algolia/instantsearch.js/compare/v4.39.1...v4.39.2) (2022-03-14)
2
11
 
3
12
 
@@ -189,7 +189,7 @@ var connectInfiniteHits = function connectInfiniteHits(renderFn) {
189
189
  results: results
190
190
  });
191
191
 
192
- if (cachedHits[_page] === undefined) {
192
+ if (cachedHits[_page] === undefined && !results.__isArtificial) {
193
193
  cachedHits[_page] = transformedHits;
194
194
  cache.write({
195
195
  state: state,
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = '4.39.2';
7
+ var _default = '4.40.0';
8
8
  exports.default = _default;
@@ -1,4 +1,4 @@
1
- /*! InstantSearch.js 4.39.2 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
1
+ /*! InstantSearch.js 4.40.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) :
@@ -2656,7 +2656,7 @@
2656
2656
  }
2657
2657
  **/
2658
2658
  /*eslint-enable */
2659
- function SearchResults(state, results) {
2659
+ function SearchResults(state, results, options) {
2660
2660
  var mainSubResponse = results[0];
2661
2661
 
2662
2662
  this._rawResults = results;
@@ -2668,6 +2668,11 @@
2668
2668
  self[key] = mainSubResponse[key];
2669
2669
  });
2670
2670
 
2671
+ // Make every key of the result options reachable from the instance
2672
+ Object.keys(options || {}).forEach(function(key) {
2673
+ self[key] = options[key];
2674
+ });
2675
+
2671
2676
  /**
2672
2677
  * query used to generate the results
2673
2678
  * @name query
@@ -4115,7 +4120,7 @@
4115
4120
 
4116
4121
  var requestBuilder_1 = requestBuilder;
4117
4122
 
4118
- var version = '3.7.0';
4123
+ var version = '3.7.3';
4119
4124
 
4120
4125
  /**
4121
4126
  * Event triggered when a parameter is set or updated
@@ -8483,7 +8488,7 @@
8483
8488
  instantSearchInstance.renderState = _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState), {}, _defineProperty({}, parentIndexName, _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState[parentIndexName]), renderState)));
8484
8489
  }
8485
8490
 
8486
- var version$1 = '4.39.2';
8491
+ var version$1 = '4.40.0';
8487
8492
 
8488
8493
  var NAMESPACE = 'ais';
8489
8494
  var component = function component(componentName) {
@@ -11667,7 +11672,7 @@
11667
11672
  results: results
11668
11673
  });
11669
11674
 
11670
- if (cachedHits[_page] === undefined) {
11675
+ if (cachedHits[_page] === undefined && !results.__isArtificial) {
11671
11676
  cachedHits[_page] = transformedHits;
11672
11677
  cache.write({
11673
11678
  state: state,